taoensso / timbre

Pure Clojure/Script logging library
https://www.taoensso.com/timbre
Eclipse Public License 1.0
1.44k stars 171 forks source link

Cannot merge config to mute logs from dependencies (sente) #324

Closed DavidVujic closed 3 years ago

DavidVujic commented 3 years ago

Hello! We are developing a web frontend written in ClojureScript and use Sente to communicate with a backend service. I looked at the sente source code and found that the library uses timbre internally. In the browser console, there are sometimes errors like [ERROR] WebSocket Error [object Event] and I guess it is logged when there is a connection problem. Or is it something we should act on in the ClojureScript code?

We have a custom client logger that picks up error logs, to notify us when there are unhandled errors in a browser. I have tried to "mute" the Sente connection error logs, by adding timbre as a depencency of our front-end ClojureScript and by using timbre/merge-config!. As I understand the sente docs, there is no API to mute the logs from there.

The only thing that I could mute the logs with was by using (timbre/set-level! :report). But that will mute all timbre loggers, and if we would like to use it in our project (or if another dependency is using it), this will disable the logging for all (I think).

I have tried these variations, without being able to mute the specific logging from the sente library.

(timbre/merge-config! {:min-level [[#{"taoensso.sente"} :report]]})
(timbre/merge-config! {:ns-filter {:deny #{"taoensso.sente"}})

I think I have succeeded with muting by using set-config!, but that muted all other ones using timbre too.

Do you have any suggestions?

DavidVujic commented 3 years ago

I just realized I had written a typo in the code. The merge-config works fine! I'll close this issue.