Class: Rad::Logger
Instance Method Summary collapse
- #debug(obj) ⇒ Object
- #error(obj) ⇒ Object
- #info(obj) ⇒ Object
-
#initialize(stream = nil) ⇒ Logger
constructor
A new instance of Logger.
- #silence(&b) ⇒ Object
- #warn(obj) ⇒ Object
Constructor Details
#initialize(stream = nil) ⇒ Logger
Returns a new instance of Logger.
2 3 4 |
# File 'lib/rad/environment/_logger.rb', line 2 def initialize stream = nil @stream = stream end |
Instance Method Details
#debug(obj) ⇒ Object
27 28 29 |
# File 'lib/rad/environment/_logger.rb', line 27 def debug obj write obj_to_string(obj).gsub(/BSON::ObjectId\(([a-z0-9'"]+)\)/, "\\1") end |
#error(obj) ⇒ Object
23 24 25 |
# File 'lib/rad/environment/_logger.rb', line 23 def error obj write "ERROR: " + obj_to_string(obj) end |
#info(obj) ⇒ Object
15 16 17 |
# File 'lib/rad/environment/_logger.rb', line 15 def info obj write obj_to_string(obj) end |
#silence(&b) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/rad/environment/_logger.rb', line 6 def silence &b begin @silence = true b.call ensure @silence = false end end |
#warn(obj) ⇒ Object
19 20 21 |
# File 'lib/rad/environment/_logger.rb', line 19 def warn obj write "WARN: " + obj_to_string(obj) end |