Module: TinkitLog
- Includes:
- Log4r
- Defined in:
- lib/helpers/log_helper.rb
Overview
Set Logger TODO: Create spec
Constant Summary collapse
- @@log_levels =
{ :debug => DEBUG, :info => INFO, :warn => WARN, :error => ERROR, :fatal => FATAL }
Class Attribute Summary collapse
-
.default_level ⇒ Object
Returns the value of attribute default_level.
-
.fatal_log ⇒ Object
Returns the value of attribute fatal_log.
-
.log_output ⇒ Object
Returns the value of attribute log_output.
Class Method Summary collapse
- .log_raise(error_msg, exc_type = RuntimeError) ⇒ Object
- .set(name, level = TinkitLog.default_level, out = Outputter.stdout) ⇒ Object
Class Attribute Details
.default_level ⇒ Object
Returns the value of attribute default_level.
8 9 10 |
# File 'lib/helpers/log_helper.rb', line 8 def default_level @default_level end |
.fatal_log ⇒ Object
Returns the value of attribute fatal_log.
8 9 10 |
# File 'lib/helpers/log_helper.rb', line 8 def fatal_log @fatal_log end |
.log_output ⇒ Object
Returns the value of attribute log_output.
8 9 10 |
# File 'lib/helpers/log_helper.rb', line 8 def log_output @log_output end |
Class Method Details
.log_raise(error_msg, exc_type = RuntimeError) ⇒ Object
30 31 32 33 |
# File 'lib/helpers/log_helper.rb', line 30 def self.log_raise(error_msg, exc_type= RuntimeError) self.fatal_log.fatal("#{__LINE__} #{error_msg}") raise exc_type, error_msg end |
.set(name, level = TinkitLog.default_level, out = Outputter.stdout) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/helpers/log_helper.rb', line 22 def self.set(name, level=TinkitLog.default_level, out=Outputter.stdout) log = Logger[name] || Logger.new(name) log.outputters = out log.level = @@log_levels[level] log.trace = true if log.level <= DEBUG log end |