Closed cemerick closed 3 years ago
Hello @cemerick , thanks for the feedback ! I have implemented a fix, log_level values should now be available directly from Easy_logging.
It should be on opam soon enough, but if you dont want to wait you can install via git clone
then opam install easy_logging.opam
from within the cloned directory.
Ok there was some problems with the fix, because the Error constructor from stdlib was hidden by the Error log_level. I have instead made the type available in the Logging module, so that no collision should happen.
You should now be able to write:
open Easy_logging
let cache_log_level = try ignore @@ Unix.getenv "CACHE_LOG"; Logging.Debug
with Not_found -> Logging.NoLevel
That looks perfectly reasonable, thanks! The trailing underscores on the "types" module just screamed "internal, don't use!" :smile:
Friendly reminder: it looks like you forgot to submit a new release PR to opam? I see the retracted https://github.com/ocaml/opam-repository/pull/14576 (presumably including the first cut of the change that shadowed Error
), but otherwise the available version remains at 0.5
.
Ok version 0.5.2 is being published to Opam (https://github.com/ocaml/opam-repository/pull/14643). I just added some methods to have better control over a logger's handlers.
As the types are currently defined, one needs to explicitly reach into
Easy_logging__.Easy_logging_types
to use log levels outside of e.g. aLogging.make_logger
call.This makes configuring loggers from some configuration more verbose than it could be, i.e. the following won't compile: