Module: Logging
- Included in:
- Bluth::ScheduleWorker, Bluth::Worker
- Defined in:
- lib/daemonizing.rb
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.
-
#silent ⇒ Object
Global silencer methods.
- #silent=(value) ⇒ Object
-
#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
179 180 181 |
# File 'lib/daemonizing.rb', line 179 def debug=(value) @debug = value end |
.silent=(value) ⇒ Object (writeonly)
Sets the attribute silent
179 180 181 |
# File 'lib/daemonizing.rb', line 179 def silent=(value) @silent = value end |
.trace=(value) ⇒ Object (writeonly)
Sets the attribute trace
179 180 181 |
# File 'lib/daemonizing.rb', line 179 def trace=(value) @trace = value end |
Class Method Details
.debug(msg = nil) ⇒ Object (writeonly)
Log a message to the console if debugging is activated
209 210 211 |
# File 'lib/daemonizing.rb', line 209 def debug(msg=nil) log msg || yield if Logging.debug? end |
.debug? ⇒ Boolean
182 |
# File 'lib/daemonizing.rb', line 182 def debug?; !@silent && @debug end |
.log(msg) ⇒ Object
Log a message to the console
195 196 197 |
# File 'lib/daemonizing.rb', line 195 def log(msg) puts msg unless Logging.silent? end |
.log_error(e = $!) ⇒ Object
Log an error backtrace if debugging is activated
216 217 218 |
# File 'lib/daemonizing.rb', line 216 def log_error(e=$!) debug "#{e}\n\t" + e.backtrace.join("\n\t") end |
.silent? ⇒ Boolean
183 |
# File 'lib/daemonizing.rb', line 183 def silent?; @silent end |
.trace(msg = nil) ⇒ Object (writeonly)
Log a message to the console if tracing is activated
202 203 204 |
# File 'lib/daemonizing.rb', line 202 def trace(msg=nil) log msg || yield if Logging.trace? end |
.trace? ⇒ Boolean
181 |
# File 'lib/daemonizing.rb', line 181 def trace?; !@silent && @trace end |
Instance Method Details
#debug(msg = nil) ⇒ Object
Log a message to the console if debugging is activated
209 210 211 |
# File 'lib/daemonizing.rb', line 209 def debug(msg=nil) log msg || yield if Logging.debug? end |
#log(msg) ⇒ Object
Log a message to the console
195 196 197 |
# File 'lib/daemonizing.rb', line 195 def log(msg) puts msg unless Logging.silent? end |
#log_error(e = $!) ⇒ Object
Log an error backtrace if debugging is activated
216 217 218 |
# File 'lib/daemonizing.rb', line 216 def log_error(e=$!) debug "#{e}\n\t" + e.backtrace.join("\n\t") end |
#silent ⇒ Object
Global silencer methods
187 188 189 |
# File 'lib/daemonizing.rb', line 187 def silent Logging.silent? end |