-
Notifications
You must be signed in to change notification settings - Fork 13
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
Way to unset/remove log handlers? #24
Comments
And maybe relatedly: I'm seeing logs being printed in Node.js despite not having called any install method.
The formatting looks like the very default of |
Martin! Long time no see :D Remove all handlers (bit hacky, no better API for this at the moment. PR welcome to add a proper function for this) (->> (goog.object/get lambdaisland.glogi/root-logger "__glogi_handlers__")
keys
(run! lambdaisland.glogi/remove-handler))
I don't think so, just started a Node based cljs repl and tried it out, doesn't log anything until I install a handler. Maybe you're loading another library that's adding a goog.log handler? |
Ha! That was it indeed. Thanks for the pointer!
Do you think something like I could also imagine that handlers are added with a key so when adding one with the same key, the old handler could be removed. From a 'trying this at the REPL' perspective this would be slightly better than In addition I might also suggest to update the docs a bit to call out that the only-once part requires the handler function to remain exactly the same, which might not always be a given with REPLs / hot reload. What do you think? |
You're right, having a key similar to e.g. in add-watch would be more convenient, that's usually how I set up these kind of APIs, but I guess here I didn't. It would make sense to either add a three-arity version to Doc clarification is always appreciated, especially if the current docs tripped you up. |
I think this functionality is basic enough that we may want to work on it in the near future, so I'm leaving this open. |
Hey there :)
Finally found some time to play with this library and gotta say it's really nice how easy it is to add a custom logger.
During development in the REPL I sometimes wanted to remove all logging handlers just to have a "clean slate". I think there's a check to not add the same handler twice but with a REPL session my handler function might have changed and glogi might not be able to know that it's intended to replace an existing handler.
Is there a way to remove all handlers for a situation like this?
Thanks 🙌
The text was updated successfully, but these errors were encountered: