Search code examples
androidandroid-workmanager

WorkManager: Hide logs in the logcat


I'm making an SDK which uses workManager to handle the background tasks. The thing is, I want my sdk to show the useful logcats I specify. But when I run a workManager task I get debug logs about SUCCESS, RETRY, etc of the 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?


Solution

  • I'd use 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.

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