Class: LogUtils::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/logutils/logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#levelObject (readonly)

Returns the value of attribute level.



23
24
25
# File 'lib/logutils/logger.rb', line 23

def level
  @level
end

#msgObject (readonly)

Returns the value of attribute msg.



24
25
26
# File 'lib/logutils/logger.rb', line 24

def msg
  @msg
end

#pidObject (readonly)

process_id



25
26
27
# File 'lib/logutils/logger.rb', line 25

def pid
  @pid
end

#tidObject (readonly)

thread_id



26
27
28
# File 'lib/logutils/logger.rb', line 26

def tid
  @tid
end

#tsObject (readonly)

timestamp



27
28
29
# File 'lib/logutils/logger.rb', line 27

def ts
  @ts
end

Instance Method Details

#to_sObject



30
31
32
# File 'lib/logutils/logger.rb', line 30

def to_s()
  "[#{level}-#{pid}.#{tid}] #{msg}"
end