Class: LogUtils::Event
- Inherits:
-
Object
- Object
- LogUtils::Event
- Defined in:
- lib/logutils/logger.rb
Instance Attribute Summary collapse
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
-
#pid ⇒ Object
readonly
process_id.
-
#tid ⇒ Object
readonly
thread_id.
-
#ts ⇒ Object
readonly
timestamp.
Instance Method Summary collapse
-
#initialize(level, msg) ⇒ Event
constructor
A new instance of Event.
- #to_s ⇒ Object
Constructor Details
#initialize(level, msg) ⇒ Event
Returns a new instance of Event.
13 14 15 16 17 18 19 20 21 |
# File 'lib/logutils/logger.rb', line 13 def initialize( level, msg ) @level = level @msg = msg @pid = Process.pid @tid = Thread.current.object_id @ts = Time.now end |
Instance Attribute Details
#level ⇒ Object (readonly)
Returns the value of attribute level.
23 24 25 |
# File 'lib/logutils/logger.rb', line 23 def level @level end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
24 25 26 |
# File 'lib/logutils/logger.rb', line 24 def msg @msg end |
#pid ⇒ Object (readonly)
process_id
25 26 27 |
# File 'lib/logutils/logger.rb', line 25 def pid @pid end |
#tid ⇒ Object (readonly)
thread_id
26 27 28 |
# File 'lib/logutils/logger.rb', line 26 def tid @tid end |
#ts ⇒ Object (readonly)
timestamp
27 28 29 |
# File 'lib/logutils/logger.rb', line 27 def ts @ts end |
Instance Method Details
#to_s ⇒ Object
30 31 32 |
# File 'lib/logutils/logger.rb', line 30 def to_s() "[#{level}-#{pid}.#{tid}] #{msg}" end |