diff --git a/arouter-api/src/main/java/com/alibaba/android/arouter/core/LogisticsCenter.java b/arouter-api/src/main/java/com/alibaba/android/arouter/core/LogisticsCenter.java index bc60ec16..506c5e77 100644 --- a/arouter-api/src/main/java/com/alibaba/android/arouter/core/LogisticsCenter.java +++ b/arouter-api/src/main/java/com/alibaba/android/arouter/core/LogisticsCenter.java @@ -88,7 +88,7 @@ private static void register(String className) { + " should implements one of IRouteRoot/IProviderGroup/IInterceptorGroup."); } } catch (Exception e) { - logger.error(TAG,"register class error:" + className); + logger.error(TAG,"register class error:" + className, e); } } } @@ -287,7 +287,8 @@ public synchronized static void completion(Postcard postcard) { Warehouse.providers.put(providerMeta, provider); instance = provider; } catch (Exception e) { - throw new HandlerException("Init provider failed! " + e.getMessage()); + logger.error(TAG, "Init provider failed!", e); + throw new HandlerException("Init provider failed!"); } } postcard.setProvider(instance); diff --git a/arouter-api/src/main/java/com/alibaba/android/arouter/facade/template/ILogger.java b/arouter-api/src/main/java/com/alibaba/android/arouter/facade/template/ILogger.java index 4f148b76..5e7fc40c 100644 --- a/arouter-api/src/main/java/com/alibaba/android/arouter/facade/template/ILogger.java +++ b/arouter-api/src/main/java/com/alibaba/android/arouter/facade/template/ILogger.java @@ -27,6 +27,8 @@ public interface ILogger { void error(String tag, String message); + void error(String tag, String message, Throwable e); + void monitor(String message); boolean isMonitorMode(); diff --git a/arouter-api/src/main/java/com/alibaba/android/arouter/launcher/_ARouter.java b/arouter-api/src/main/java/com/alibaba/android/arouter/launcher/_ARouter.java index ef21c8cc..79a94f81 100644 --- a/arouter-api/src/main/java/com/alibaba/android/arouter/launcher/_ARouter.java +++ b/arouter-api/src/main/java/com/alibaba/android/arouter/launcher/_ARouter.java @@ -492,7 +492,7 @@ boolean addRouteGroup(IRouteGroup group) { return true; } catch (Exception exception) { - logger.error(Consts.TAG, "Add route group dynamic exception! " + exception.getMessage()); + logger.error(Consts.TAG, "Add route group dynamic exception!", exception); } return false; diff --git a/arouter-api/src/main/java/com/alibaba/android/arouter/utils/DefaultLogger.java b/arouter-api/src/main/java/com/alibaba/android/arouter/utils/DefaultLogger.java index ac836966..882d3d46 100644 --- a/arouter-api/src/main/java/com/alibaba/android/arouter/utils/DefaultLogger.java +++ b/arouter-api/src/main/java/com/alibaba/android/arouter/utils/DefaultLogger.java @@ -71,6 +71,14 @@ public void error(String tag, String message) { } } + @Override + public void error(String tag, String message, Throwable e) { + if (isShowLog) { + Log.e(TextUtils.isEmpty(tag) ? getDefaultTag() : tag, message, e); + } + } + + @Override public void monitor(String message) { if (isShowLog && isMonitorMode()) {