Class: HrrRbSsh::Logger
- Inherits:
-
Object
- Object
- HrrRbSsh::Logger
- Defined in:
- lib/hrr_rb_ssh/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.
22 23 24 |
# File 'lib/hrr_rb_ssh/logger.rb', line 22 def initialize name @name = name end |
Class Method Details
.initialize(logger) ⇒ Object
9 10 11 |
# File 'lib/hrr_rb_ssh/logger.rb', line 9 def initialize logger @@logger = logger end |
.initialized? ⇒ Boolean
17 18 19 |
# File 'lib/hrr_rb_ssh/logger.rb', line 17 def initialized? @@logger != nil end |
.uninitialize ⇒ Object
13 14 15 |
# File 'lib/hrr_rb_ssh/logger.rb', line 13 def uninitialize @@logger = nil end |
Instance Method Details
#debug ⇒ Object
50 51 52 53 54 |
# File 'lib/hrr_rb_ssh/logger.rb', line 50 def debug if @@logger @@logger.debug { "p#{Process.pid}.t#{Thread.current.object_id}: #{@name}: #{yield}" } end end |
#error ⇒ Object
32 33 34 35 36 |
# File 'lib/hrr_rb_ssh/logger.rb', line 32 def error if @@logger @@logger.error { "p#{Process.pid}.t#{Thread.current.object_id}: #{@name}: #{yield}" } end end |
#fatal ⇒ Object
26 27 28 29 30 |
# File 'lib/hrr_rb_ssh/logger.rb', line 26 def fatal if @@logger @@logger.fatal { "p#{Process.pid}.t#{Thread.current.object_id}: #{@name}: #{yield}" } end end |
#info ⇒ Object
44 45 46 47 48 |
# File 'lib/hrr_rb_ssh/logger.rb', line 44 def info if @@logger @@logger.info { "p#{Process.pid}.t#{Thread.current.object_id}: #{@name}: #{yield}" } end end |
#warn ⇒ Object
38 39 40 41 42 |
# File 'lib/hrr_rb_ssh/logger.rb', line 38 def warn if @@logger @@logger.warn { "p#{Process.pid}.t#{Thread.current.object_id}: #{@name}: #{yield}" } end end |