lambdaisland / glogi

A ClojureScript logging library based on goog.log
Mozilla Public License 2.0
119 stars 13 forks source link

Fix single-argument lambdaisland.glogi/logger erasing logger level #14

Closed ak-coram closed 3 years ago

ak-coram commented 3 years ago

Hi, the new version of lambdaisland.glogi/logger in 1.0.100 seems to unintentionally set the level of the logger to nil when called with a single argument:

l.glogi> (logger "" (:config levels))
#js{:getName #object[getName], :__glogi_handlers__ {#object[Function] #object[log_record_handler]}}
l.glogi> (glog/getLevel root-logger)
#object[Level CONFIG]
l.glogi> (logger "")
#js{:getName #object[getName], :__glogi_handlers__ {#object[Function] #object[log_record_handler]}}
l.glogi> (glog/getLevel root-logger)
nil

This is done to the root logger when the namespace is first loaded (via (def root-logger (logger ""))), leading to various issues: https://github.com/bhauman/figwheel-main/issues/289

This change passes js/undefined to goog.log/getLogger instead of nil to keep the original level of the logger intact.

plexus commented 3 years ago

Thanks! will put this out right away.

plexus commented 3 years ago

Released in

[lambdaisland/glogi "1.0.106"]
{lambdaisland/glogi {:mvn/version "1.0.106"}}