Class: EaseEngine::Log::DailyRotateFile
- Inherits:
-
RotateFile
- Object
- IO
- RotateFile
- EaseEngine::Log::DailyRotateFile
- Defined in:
- lib/ease_engine/log.rb
Instance Attribute Summary
Attributes inherited from RotateFile
Attributes inherited from IO
Instance Method Summary collapse
-
#initialize(*args) ⇒ DailyRotateFile
constructor
A new instance of DailyRotateFile.
- #is_daily(time) ⇒ Object
- #on_daily(time) ⇒ Object
- #write(time, msg) ⇒ Object
Methods inherited from RotateFile
Methods inherited from IO
Constructor Details
#initialize(*args) ⇒ DailyRotateFile
Returns a new instance of DailyRotateFile.
47 48 49 50 51 |
# File 'lib/ease_engine/log.rb', line 47 def initialize( *args ) super( *args ) @check_time = EaseEngine::Time.new end |
Instance Method Details
#is_daily(time) ⇒ Object
59 60 61 |
# File 'lib/ease_engine/log.rb', line 59 def is_daily( time ) ! @check_time.is_same_day( time ) && @max_size <= @file.size end |
#on_daily(time) ⇒ Object
63 64 65 66 |
# File 'lib/ease_engine/log.rb', line 63 def on_daily( time ) rotate( sprintf( "%s_%04d%02d%02d", @file.path, @check_time.year, @check_time.month, @check_time.day ) ) @check_time = time end |
#write(time, msg) ⇒ Object
53 54 55 56 57 |
# File 'lib/ease_engine/log.rb', line 53 def write( time, msg ) on_daily( time ) if is_daily( time ) super( time, msg ) end |