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
23 24 25 26 27 28 29 30 31 |
# File 'lib/raad/logger.rb', line 23 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 |
# File 'lib/raad/logger.rb', line 10 def setup( = {}) @log = Log4r::Logger.new('raad') log_format = Log4r::PatternFormatter.new(:pattern => "[#{Process.pid}:%l] %d :: %m") 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 |