taoensso / timbre

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

Automatic initialization of logging config #332

Closed alexhall closed 1 year ago

alexhall commented 3 years ago

One thing I've come to appreciate about the various Java logging frameworks is that they are capable of initializing themselves (generally from system properties and/or resources on the classpath) with user-provided configuration either upon system startup or initial usage, when the very first message is logged. How would you feel about adding similar capability to Timbre?

I have a couple of use-cases in mind with this feature request:

One possible approach would be to look for a timbre.edn resource on the classpath, which could either embed a config map for simple configurations, or for more complex configurations could be a namespaced symbol that names a var for Timbre to dereference to obtain a config map. I think the main drawback would be the slight overhead to check the initialization status on every system startup and/or every logging call, but IMO that would be a worthwhile tradeoff.

ptaoussanis commented 3 years ago

Hi Alex! Seems reasonable to me, would be happy to look at a PR šŸ‘

ptaoussanis commented 1 year ago

This will be included with forthcoming release šŸ‘ Cheers! :-)