Class: Flamingo::Logging::EventLog
- Inherits:
-
Object
- Object
- Flamingo::Logging::EventLog
- Defined in:
- lib/flamingo/logging/event_log.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
Returns the value of attribute dir.
-
#max_size ⇒ Object
Returns the value of attribute max_size.
Instance Method Summary collapse
- #append(event) ⇒ Object (also: #<<)
-
#initialize(dir, size = 10000) ⇒ EventLog
constructor
A new instance of EventLog.
- #open? ⇒ Boolean
Constructor Details
#initialize(dir, size = 10000) ⇒ EventLog
Returns a new instance of EventLog.
7 8 9 10 11 12 13 14 15 |
# File 'lib/flamingo/logging/event_log.rb', line 7 def initialize(dir,size=10000) self.dir = dir self.max_size = size @rotations = 0 rotate! unless open? raise "Failure opening log file" end end |
Instance Attribute Details
#dir ⇒ Object
Returns the value of attribute dir.
5 6 7 |
# File 'lib/flamingo/logging/event_log.rb', line 5 def dir @dir end |
#max_size ⇒ Object
Returns the value of attribute max_size.
5 6 7 |
# File 'lib/flamingo/logging/event_log.rb', line 5 def max_size @max_size end |
Instance Method Details
#append(event) ⇒ Object Also known as: <<
17 18 19 20 21 22 23 |
# File 'lib/flamingo/logging/event_log.rb', line 17 def append(event) if should_rotate? rotate! end @log << "#{event}\n" @event_count += 1 end |
#open? ⇒ Boolean
26 27 28 |
# File 'lib/flamingo/logging/event_log.rb', line 26 def open? !@log.nil? end |