class PlainLogger::Plain

Plain logger

Public Class Methods

new(plugin_name, options) click to toggle source
# File lib/plugins/plain_logger.rb, line 8
def initialize(plugin_name, options)
  path = LogHelper.log_file_path(options[:log_file])
  log_file = path ? Logger.new(path) : nil
  log_level = LogHelper.parse_log_level(options[:log_level])
  formatter = LogHelper.output_formatter(LogHelper.output_format(log_file), plugin_name)
  @out_log = logger(STDOUT, log_file, log_level, formatter)
  @err_log = logger(STDERR, log_file, log_level, formatter)
end

Public Instance Methods

dbg(message) click to toggle source
# File lib/plugins/plain_logger.rb, line 17
def dbg(message)
  @out_log.debug message.to_s
end
dbg?() click to toggle source
# File lib/plugins/plain_logger.rb, line 37
def dbg?
  @out_log.debug?
end
err(message) click to toggle source
# File lib/plugins/plain_logger.rb, line 29
def err(message)
  @err_log.error message.to_s
end
err?() click to toggle source
# File lib/plugins/plain_logger.rb, line 49
def err?
  @err_log.error?
end
ftl(message) click to toggle source
# File lib/plugins/plain_logger.rb, line 33
def ftl(message)
  @err_log.fatal message.to_s
end
ftl?() click to toggle source
# File lib/plugins/plain_logger.rb, line 53
def ftl?
  @err_log.fatal?
end
inf(message) click to toggle source
# File lib/plugins/plain_logger.rb, line 21
def inf(message)
  @out_log.info message.to_s
end
inf?() click to toggle source
# File lib/plugins/plain_logger.rb, line 41
def inf?
  @out_log.info?
end
wrn(message) click to toggle source
# File lib/plugins/plain_logger.rb, line 25
def wrn(message)
  @out_log.warn message.to_s
end
wrn?() click to toggle source
# File lib/plugins/plain_logger.rb, line 45
def wrn?
  @out_log.warn?
end

Private Instance Methods

logger(std, log_file, log_level, formatter) click to toggle source
# File lib/plugins/plain_logger.rb, line 59
def logger(std, log_file, log_level, formatter)
  log = log_file || Logger.new(std)
  log.level = log_level
  log.formatter = formatter
  log
end