module Logging
Universal global logging
Constants
- SEVERITY_COLORS
Public Class Methods
configure_logger_for(classname)
click to toggle source
# File lib/elastic_manager/logger.rb, line 39 def configure_logger_for(classname) logger = Logger.new(STDOUT) logger.progname = classname logger.level = log_level logger.formatter = proc do |severity, datetime, progname, msg| datetime = datetime.strftime('%Y-%m-%d | %I:%M:%S.%L') message = "#{datetime} | #{progname} | #{severity} | #{msg}\n" message.send(SEVERITY_COLORS[severity]) end logger end
log_level()
click to toggle source
# File lib/elastic_manager/logger.rb, line 30 def log_level # :debug < :info < :warn < :error < :fatal < :unknown if ENV['LOG_LEVEL'] == '' || ENV['LOG_LEVEL'].nil? 'INFO' else ENV['LOG_LEVEL'] end end
logger_for(classname)
click to toggle source
# File lib/elastic_manager/logger.rb, line 26 def logger_for(classname) @loggers[classname] ||= configure_logger_for(classname) end
Public Instance Methods
log()
click to toggle source
# File lib/elastic_manager/logger.rb, line 17 def log @log ||= Logging.logger_for(self.class.name) end