On 14 March 2016 at 12:55, sebb <[email protected]> wrote: > It would be useful to be able to initialise the default log level but > still allow CLI over-ride. > > I've found a hacky fix: > > Wunderbar.log_level = 'info' unless Wunderbar.log_level == 'debug' # > don't override command-line level > > however that relies on knowing that debug (and only debug) is more > verbose than info.
I can improve that with: Wunderbar.log_level = 'info' unless Wunderbar.logger.info? however this still overrides a CLI arg of --warn etc. I tried another hack: ARGV.unshift '--info' at the start of the script, but that does not work properly because Wunderbar does not process ARGV in order. But even if it did, updating the args would be a hack. So I think there needs to be a way to override the default level. It would also be useful to be able to override the default output stream; $stderr is not always suitable. > Also modifying the formatter message is a bit messy; it would be > useful if this could be specified when creating the logger. > > I don't know how to do this in Ruby - if it's even possible?
