Sha256: 488b7432fe111b5fe8c93b3c8446e1c760d40a4de53db2a50e47cc0d88deaac8
Contents?: true
Size: 691 Bytes
Versions: 6
Compression:
Stored size: 691 Bytes
Contents
require 'logger' module AwsAlertMonitor class Logger require 'forwardable' extend Forwardable def_delegators :@logger, :debug, :error, :info, :warn def initialize(args = {}) @log_level = args[:log_level] ||= 'info' @logger = args[:logger] ||= new_logger(args) end private def new_logger(args) ::Logger.new(STDOUT).tap do |l| l.datetime_format = '%Y-%m-%dT%H:%M:%S%z' l.formatter = proc do |severity, datetime, progname, msg| "#{datetime} #{severity} : #{msg}\n" end l.level = logger_level end end def logger_level ::Logger.const_get @log_level.upcase end end end
Version data entries
6 entries across 6 versions & 1 rubygems