Module: Thin::Logging
- Defined in:
- lib/omf-web/thin/logging.rb
Overview
Overwrite thin’s logging mix-in to work more nicely with log4r
Class Attribute Summary collapse
-
.debug ⇒ Object
writeonly
Sets the attribute debug.
-
.silent ⇒ Object
writeonly
Sets the attribute silent.
-
.trace ⇒ Object
writeonly
Sets the attribute trace.
Class Method Summary collapse
-
.debug(msg = nil) ⇒ Object
writeonly
Log a message to the console if debugging is activated.
- .debug? ⇒ Boolean
-
.log(msg) ⇒ Object
Log a message to the console.
-
.log_error(e = $!) ⇒ Object
Log an error backtrace if debugging is activated.
- .silent? ⇒ Boolean
-
.trace(msg = nil) ⇒ Object
writeonly
Log a message to the console if tracing is activated.
- .trace? ⇒ Boolean
Instance Method Summary collapse
-
#debug(msg = nil) ⇒ Object
Log a message to the console if debugging is activated.
-
#log(msg) ⇒ Object
Log a message to the console.
-
#log_error(e = $!) ⇒ Object
Log an error backtrace if debugging is activated.
-
#trace(msg = nil) ⇒ Object
Log a message to the console if tracing is activated.
Class Attribute Details
.debug=(value) ⇒ Object (writeonly)
Sets the attribute debug
9 10 11 |
# File 'lib/omf-web/thin/logging.rb', line 9 def debug=(value) @debug = value end |
.silent=(value) ⇒ Object (writeonly)
Sets the attribute silent
9 10 11 |
# File 'lib/omf-web/thin/logging.rb', line 9 def silent=(value) @silent = value end |
.trace=(value) ⇒ Object (writeonly)
Sets the attribute trace
9 10 11 |
# File 'lib/omf-web/thin/logging.rb', line 9 def trace=(value) @trace = value end |
Class Method Details
.debug(msg = nil) ⇒ Object (writeonly)
Log a message to the console if debugging is activated
40 41 42 43 |
# File 'lib/omf-web/thin/logging.rb', line 40 def debug(msg=nil) return unless msg (@logger ||= OMF::Common::LObject.new(self.class)).debug(msg) end |
.debug? ⇒ Boolean
12 |
# File 'lib/omf-web/thin/logging.rb', line 12 def debug?; !@silent && @debug end |
.log(msg) ⇒ Object
Log a message to the console
25 26 27 |
# File 'lib/omf-web/thin/logging.rb', line 25 def log(msg) (@logger ||= OMF::Common::LObject.new(self.class)).info(msg) end |
.log_error(e = $!) ⇒ Object
Log an error backtrace if debugging is activated
48 49 50 |
# File 'lib/omf-web/thin/logging.rb', line 48 def log_error(e = $!) (@logger ||= OMF::Common::LObject.new(self.class)).error(e) end |
.silent? ⇒ Boolean
13 |
# File 'lib/omf-web/thin/logging.rb', line 13 def silent?; @silent end |
.trace(msg = nil) ⇒ Object (writeonly)
Log a message to the console if tracing is activated
32 33 34 35 |
# File 'lib/omf-web/thin/logging.rb', line 32 def trace(msg=nil) return unless msg (@logger ||= OMF::Common::LObject.new(self.class)).debug(msg) end |
.trace? ⇒ Boolean
11 |
# File 'lib/omf-web/thin/logging.rb', line 11 def trace?; !@silent && @trace end |
Instance Method Details
#debug(msg = nil) ⇒ Object
Log a message to the console if debugging is activated
40 41 42 43 |
# File 'lib/omf-web/thin/logging.rb', line 40 def debug(msg=nil) return unless msg (@logger ||= OMF::Common::LObject.new(self.class)).debug(msg) end |
#log(msg) ⇒ Object
Log a message to the console
25 26 27 |
# File 'lib/omf-web/thin/logging.rb', line 25 def log(msg) (@logger ||= OMF::Common::LObject.new(self.class)).info(msg) end |