简体   繁体   English

WorkManager:在 logcat 中隐藏日志

[英]WorkManager: Hide logs in the logcat

I'm making an SDK which uses workManager to handle the background tasks.我正在制作一个使用 workManager 来处理后台任务的 SDK。 The thing is, I want my sdk to show the useful logcats I specify.问题是,我希望我的 sdk 显示我指定的有用 logcat。 But when I run a workManager task I get debug logs about SUCCESS, RETRY, etc of the workManager.但是,当我运行 workManager 任务时,我会收到有关 workManager 的成功、重试等的调试日志。

Worker result SUCCESS for Work [ id=44a0ed5d-69c5-4318-84eb-69680d1c3647, tags={ TaskPerformer, my_task } ]

Is there anyway to hide these logs since they are not useful for the developer who uses the library?无论如何要隐藏这些日志,因为它们对使用该库的开发人员没有用处?

I'd use setMinimumLoggingLevel(android.util.Log.ASSERT) .我会使用setMinimumLoggingLevel(android.util.Log.ASSERT)

It's may be kind of a hack since there's no "disable logging" in WorkManager's API AFAIK, but it'll get the job.这可能是一种黑客行为,因为 WorkManager 的 API AFAIK 中没有“禁用日志记录”,但它会得到这份工作。

From the docs: https://developer.android.com/topic/libraries/architecture/workmanager/how-to/debugging来自文档: https : //developer.android.com/topic/libraries/architecture/workmanager/how-to/debugging

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM