elvishew/xLog

能否动态设置打印堆栈信息呢?

chenchongyu opened this issue · 1 comments

如题,只想在error级别的日志里打印堆栈信息,其他级别日志不打印,有什么办法吗?

@chenchongyu
You can use a Interceptor.
Set threadInfo to null when level is NOT ERROR.

intercept(log) {
  if (log.level < ERROR) {
    log.threadInfo = null;
    return log;
  }
}