Module: Lita::Logger

Defined in:
lib/lita/logger.rb

Overview

Creates a Logger with the proper configuration.

Class Method Summary collapse

Class Method Details

.get_logger(level) ⇒ ::Logger

Creates a new Logger outputting to standard error with the given severity level and a custom format.

Parameters:

  • level (Symbol, String)

    The name of the log level to use.

Returns:

  • (::Logger)

    The Logger object.


9
10
11
12
13
14
15
16
# File 'lib/lita/logger.rb', line 9

def get_logger(level)
  logger = ::Logger.new(STDERR)
  logger.level = get_level_constant(level)
  logger.formatter = proc do |severity, datetime, _progname, msg|
    "[#{datetime.utc}] #{severity}: #{msg}\n"
  end
  logger
end