Module: Raad::Logger
Instance Method Summary collapse
- #level=(l) ⇒ Object
-
#setup(options = {}) ⇒ Logger
Sets up the logging for the runner.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args) ⇒ Object (private)
59 60 61 |
# File 'lib/raad/logger.rb', line 59 def method_missing(sym, *args) @log.send(sym, *args) end |
Instance Method Details
#level=(l) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/raad/logger.rb', line 25 def level=(l) levels = { :debug => Log4r::DEBUG, :info => Log4r::INFO, :warn => Log4r::WARN, :error => Log4r::ERROR, } @log.level = @verbose ? Log4r::DEBUG : levels[l] end |
#setup(options = {}) ⇒ Logger
Sets up the logging for the runner
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/raad/logger.rb', line 10 def setup( = {}) @log = Log4r::Logger.new('raad') # select only :pattern, :date_pattern, :date_method and flush nils = {:pattern => "[#{Process.pid}:%l] %d :: %m"}.merge(.reject{|k, v| !([:pattern, :date_pattern, :date_method].include?(k) && !v.nil?)}) log_format = Log4r::PatternFormatter.new() setup_file_logger(@log, log_format, [:file]) if [:file] setup_stdout_logger(@log, log_format) if [:stdout] @verbose = !![:verbose] @log.level = @verbose ? Log4r::DEBUG : Log4r::INFO @log end |