xLog icon indicating copy to clipboard operation
xLog copied to clipboard

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

Open chenchongyu opened this issue 3 years ago • 1 comments

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

chenchongyu avatar Nov 25 '21 03:11 chenchongyu

@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;
  }
}

elvishew avatar Nov 26 '21 02:11 elvishew