Class: Logbert::Message
- Inherits:
-
Object
- Object
- Logbert::Message
- Defined in:
- lib/logbert/message.rb
Instance Attribute Summary collapse
-
#content_proc ⇒ Object
readonly
Returns the value of attribute content_proc.
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Class Method Summary collapse
Instance Method Summary collapse
-
#content ⇒ Object
Returns the content.
-
#initialize(logger, level, time, pid, exception, options, content = nil, &content_proc) ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize(logger, level, time, pid, exception, options, content = nil, &content_proc) ⇒ Message
Returns a new instance of Message.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/logbert/message.rb', line 7 def initialize(logger, level, time, pid, exception, , content = nil, &content_proc) @logger = logger @level = level @time = time @pid = pid @exception = exception @options = @content = content @content_proc = content_proc end |
Instance Attribute Details
#content_proc ⇒ Object (readonly)
Returns the value of attribute content_proc.
5 6 7 |
# File 'lib/logbert/message.rb', line 5 def content_proc @content_proc end |
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
5 6 7 |
# File 'lib/logbert/message.rb', line 5 def exception @exception end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
5 6 7 |
# File 'lib/logbert/message.rb', line 5 def level @level end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
5 6 7 |
# File 'lib/logbert/message.rb', line 5 def logger @logger end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/logbert/message.rb', line 5 def @options end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
5 6 7 |
# File 'lib/logbert/message.rb', line 5 def pid @pid end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
5 6 7 |
# File 'lib/logbert/message.rb', line 5 def time @time end |
Class Method Details
Instance Method Details
#content ⇒ Object
Returns the content. If the content has not been created yet, then call @content_proc and save the value.
25 26 27 28 29 30 31 32 33 |
# File 'lib/logbert/message.rb', line 25 def content @content ||= begin if @content_proc @content_proc.call.to_s else "" end end end |