jordansissel/ruby-cabin

Add log level option to subscribe method

Closed this issue · 1 comments

jsvd commented

The idea behind this is to allow

logger = Cabin::Channel.get
logger.level = :info
logger.subscribe(File.open("/tmp/log", "a"), :info) # :debug would be the same as nil
logger.subscribe(STDOUT, :warn)

Such that:

  • logger.debug("test") won't be sent anywhere
  • logger.info("test") is sent only to the logfile
  • logger.fatal("test") is sent to both

hmm, I'm open to this idea. For backwards compat, we can have subscribe(IO) with no level default to :debug