module Logging

Public Class Methods

log_level() click to toggle source
# File lib/logging.rb, line 20
def self.log_level
  # default to only showing errors
  ENV.fetch("RUBY_LOG_LEVEL", "ERROR")
end
logger() click to toggle source
# File lib/logging.rb, line 10
def self.logger
  @logger ||= Logger.new($stdout)
  @logger.formatter = proc do |severity, datetime, _progname, msg|
    datefmt = datetime.strftime("%Y-%m-%d %H:%M:%S")
    # ensure that there is only one newline at the end of the message
    "#{severity} [#{datefmt}]: #{msg}\n".gsub!(/\n+/, "\n")
  end
  @logger
end

Public Instance Methods

logger() click to toggle source
# File lib/logging.rb, line 6
def logger
  Logging.logger
end