module Logging
Public: Logging
module to mixin with classes.
Public Class Methods
configure_logger_for(classname)
click to toggle source
# File lib/linkedin2cv/logging.rb, line 22 def configure_logger_for(classname) logger = Logger.new classname.to_s.gsub(/[^a-zA-Z0-9]/, '.').downcase.gsub(/\.+/, '.') # Log to file or stdout? if (ENV['LOG_OUTPUT_FILENAME'] && !ENV['LOG_OUTPUT_FILENAME'].empty?) puts ENV['LOG_OUTPUT_FILENAME'] logger.outputters << Log4r::FileOutputter.new('linkedin2cvlog', :filename => ENV['LOG_OUTPUT_FILENAME']) elsif logger.outputters << Log4r::StdoutOutputter.new('linkedin2cvlog') end logger end
logger_for(classname)
click to toggle source
# File lib/linkedin2cv/logging.rb, line 18 def logger_for(classname) @loggers[classname] ||= configure_logger_for(classname) end
Public Instance Methods
log()
click to toggle source
# File lib/linkedin2cv/logging.rb, line 8 def log @log ||= Logging.logger_for(self.class.name) end