我需要在生产版本中精简所有木材日志。我在proguard-project.txt中添加了以下内容:
-assumenosideeffects class timber.log.Timber* {
public static *** tag(...);
public static *** v(...);
public static *** i(...);
public static *** w(...);
public static *** d(...);
public static *** e(...);
-assumenosideeffects class timber.log.Timber.tag* {*;}
}
但是仅清除格式为Timber.e()
或Timber.i()
等的日志。带有Timber.tag(..).i(...)
的日志不会被剥离。
有什么方法可以实现这一目标?谢谢
做一行事情会不会更容易
if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}
在您的Application子类中?这样,您将只在调试中记录日志