Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎么分开设置控制台打印和写入文件的日志级别 #136

Open
haichenyi opened this issue Jul 5, 2022 · 1 comment
Open

Comments

@haichenyi
Copy link

比方说,我现在正式环境不想打印日志,但是想把日志都写入到文件里面,该如何实现,我看源码,直接是在Logger层就全部拦截掉了。所有的printer都是公用的一个config,也就是公用的一个日志级别。
不能说正式环境只初始化一个FilePrinter,测试环境只初始化一个AndroidPrinter。正式环境也可能需要打印日志。需要动态设置能否打印日志,我可能初始化的时候需要打印日志,然后,就需要把打印日志关闭。反正,就是控制台打印跟写入文件有不同的开关控制。这个功能现在有吗?

@PengShaoLei97
Copy link

可以提供一下初始化的代码片段吗?或者可以参考我的写法。(在debug下只打印日志但不保存,release下不打印日志但保存)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants