Class: Pebble::Watch::LogEvent
- Defined in:
- lib/pebble/watch/log_event.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#level ⇒ Object
Returns the value of attribute level.
-
#linenumber ⇒ Object
Returns the value of attribute linenumber.
-
#message ⇒ Object
Returns the value of attribute message.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename.
6 7 8 |
# File 'lib/pebble/watch/log_event.rb', line 6 def filename @filename end |
#level ⇒ Object
Returns the value of attribute level.
5 6 7 |
# File 'lib/pebble/watch/log_event.rb', line 5 def level @level end |
#linenumber ⇒ Object
Returns the value of attribute linenumber.
7 8 9 |
# File 'lib/pebble/watch/log_event.rb', line 7 def linenumber @linenumber end |
#message ⇒ Object
Returns the value of attribute message.
8 9 10 |
# File 'lib/pebble/watch/log_event.rb', line 8 def @message end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
4 5 6 |
# File 'lib/pebble/watch/log_event.rb', line 4 def @timestamp end |
Class Method Details
.parse(raw_message) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/pebble/watch/log_event.rb', line 10 def self.parse() return nil if .length < 8 , level, , linenumber = [0, 8].unpack("L>CCS>") filename = [8, 16] = [24, ] log_levels = { 1 => :error, 50 => :warning, 100 => :info, 200 => :debug, 250 => :verbose } event = new event. = Time.at() event.level = log_levels[level] || :unknown event.linenumber = linenumber event.filename = filename event. = event end |
Instance Method Details
#inspect ⇒ Object
36 37 38 |
# File 'lib/pebble/watch/log_event.rb', line 36 def inspect "[#{self.level.to_s.capitalize}] #{self.}" end |