Class: Rubyang::Model::Logger
- Inherits:
-
Object
- Object
- Rubyang::Model::Logger
- Defined in:
- lib/rubyang/model/logger.rb
Constant Summary collapse
- @@logger =
nil
Class Method Summary collapse
Instance Method Summary collapse
- #debug ⇒ Object
- #error ⇒ Object
- #fatal ⇒ Object
- #info ⇒ Object
-
#initialize(name) ⇒ Logger
constructor
A new instance of Logger.
- #warn ⇒ Object
Constructor Details
#initialize(name) ⇒ Logger
Returns a new instance of Logger.
23 24 25 |
# File 'lib/rubyang/model/logger.rb', line 23 def initialize name @name = name end |
Class Method Details
.initialize(logger) ⇒ Object
10 11 12 |
# File 'lib/rubyang/model/logger.rb', line 10 def initialize logger @@logger = logger end |
.initialized? ⇒ Boolean
18 19 20 |
# File 'lib/rubyang/model/logger.rb', line 18 def initialized? @@logger != nil end |
.uninitialize ⇒ Object
14 15 16 |
# File 'lib/rubyang/model/logger.rb', line 14 def uninitialize @@logger = nil end |
Instance Method Details
#debug ⇒ Object
51 52 53 54 55 |
# File 'lib/rubyang/model/logger.rb', line 51 def debug if @@logger @@logger.debug { "#{@name}: #{yield}" } end end |
#error ⇒ Object
33 34 35 36 37 |
# File 'lib/rubyang/model/logger.rb', line 33 def error if @@logger @@logger.error { "#{@name}: #{yield}" } end end |
#fatal ⇒ Object
27 28 29 30 31 |
# File 'lib/rubyang/model/logger.rb', line 27 def fatal if @@logger @@logger.fatal { "#{@name}: #{yield}" } end end |
#info ⇒ Object
45 46 47 48 49 |
# File 'lib/rubyang/model/logger.rb', line 45 def info if @@logger @@logger.info { "#{@name}: #{yield}" } end end |
#warn ⇒ Object
39 40 41 42 43 |
# File 'lib/rubyang/model/logger.rb', line 39 def warn if @@logger @@logger.warn { "#{@name}: #{yield}" } end end |