Module: Logging
- Extended by:
- Log4r
- Included in:
- Linkedin2CV::AbstractCommand, Linkedin2CV::Converter
- Defined in:
- lib/linkedin2cv/logging.rb
Overview
Public: Logging module to mixin with classes.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.configure_logger_for(classname) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# 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) ⇒ Object
18 19 20 |
# File 'lib/linkedin2cv/logging.rb', line 18 def logger_for(classname) @loggers[classname] ||= configure_logger_for(classname) end |
Instance Method Details
#log ⇒ Object
8 9 10 |
# File 'lib/linkedin2cv/logging.rb', line 8 def log @log ||= Logging.logger_for(self.class.name) end |