Class: Dreamcatcher::LoggerProxy::LogEntry
- Inherits:
-
Object
- Object
- Dreamcatcher::LoggerProxy::LogEntry
- Defined in:
- lib/dreamcatcher/logger_proxy.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(severity, prog, message, timestamp = nil) ⇒ LogEntry
constructor
A new instance of LogEntry.
- #to_s(format = '%t [%s] %m') ⇒ Object
Constructor Details
#initialize(severity, prog, message, timestamp = nil) ⇒ LogEntry
Returns a new instance of LogEntry.
51 52 53 54 55 56 |
# File 'lib/dreamcatcher/logger_proxy.rb', line 51 def initialize(severity, prog, , = nil) @severity = severity @prog = prog @message = @timestamp = || Time.now end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
49 50 51 |
# File 'lib/dreamcatcher/logger_proxy.rb', line 49 def @message end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
49 50 51 |
# File 'lib/dreamcatcher/logger_proxy.rb', line 49 def severity @severity end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
49 50 51 |
# File 'lib/dreamcatcher/logger_proxy.rb', line 49 def @timestamp end |
Instance Method Details
#to_s(format = '%t [%s] %m') ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/dreamcatcher/logger_proxy.rb', line 58 def to_s(format = '%t [%s] %m') format. sub('%s', format_severity). sub('%m', @message || ''). sub('%p', @prog || ''). sub('%t', ) end |