Module: Rapid::Logger

Defined in:
lib/ury_rapid/logger.rb

Overview

Utility functions for logging

Rapid::Logger defines a method, #default_logger, that provides a sensible logging format for Rapid.

Class Method Summary collapse

Class Method Details

.default_loggerObject

Constructs the default Rapid logger configuration


10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ury_rapid/logger.rb', line 10

def self.default_logger
  # TODO: Allow redirecting
  output = STDERR
  ::Logger.new(output).tap do |logger|
    logger.formatter = proc do |severity, datetime, _progname, msg|
      [format_date(datetime, output),
       format_severity(severity, output),
       msg].join(' ') + "\n"
    end
  end
end