Class: Yell::Adapters::Datefile
- Defined in:
- lib/yell/adapters/datefile.rb
Overview
The Datefile
adapter is similar to the File
adapter. However, it rotates the file at midnight (by default).
Constant Summary collapse
- DefaultDatePattern =
The default date pattern, e.g. “19820114” (14 Jan 1982)
"%Y%m%d"
- Header =
Metadata
lambda { |date, pattern| "# -*- #{date.iso8601} (#{date.to_f}) [#{pattern}] -*-" }
- HeaderRegexp =
/^# -\*- (.+) \((\d+\.\d+)\) \[(.+)\] -\*-$/
Constants inherited from Io
Instance Attribute Summary collapse
-
#date_pattern ⇒ Object
The pattern to be used for the files.
-
#header ⇒ Object
You can suppress the first line of the logfile that contains the metadata.
-
#keep ⇒ Object
Set the amount of logfiles to keep when rolling over.
-
#symlink ⇒ Object
Tell the adapter to create a symlink onto the currently active (timestamped) file.
Attributes inherited from Io
Method Summary
Methods inherited from Io
Methods included from Helpers::Formatter
Methods inherited from Base
close, #close, #initialize, #inspect, open, setup, write, #write
Methods included from Helpers::Level
Constructor Details
This class inherits a constructor from Yell::Adapters::Base
Instance Attribute Details
#date_pattern ⇒ Object
The pattern to be used for the files
22 23 24 |
# File 'lib/yell/adapters/datefile.rb', line 22 def date_pattern @date_pattern end |
#header ⇒ Object
You can suppress the first line of the logfile that contains the metadata. This is important upon rollover, because on *nix systems, it is not possible to determine the creation time of a file, on the last access time. The header compensates this.
50 51 52 |
# File 'lib/yell/adapters/datefile.rb', line 50 def header @header end |
#keep ⇒ Object
Set the amount of logfiles to keep when rolling over. By default, no files will be cleaned up.
41 42 43 |
# File 'lib/yell/adapters/datefile.rb', line 41 def keep @keep end |
#symlink ⇒ Object
Tell the adapter to create a symlink onto the currently active (timestamped) file. Upon rollover, the symlink is set to the newly created file, and so on.
30 31 32 |
# File 'lib/yell/adapters/datefile.rb', line 30 def symlink @symlink end |