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
20 21 22 |
# File 'lib/yell/adapters/datefile.rb', line 20 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.
48 49 50 |
# File 'lib/yell/adapters/datefile.rb', line 48 def header @header end |
#keep ⇒ Object
Set the amount of logfiles to keep when rolling over. By default, no files will be cleaned up.
39 40 41 |
# File 'lib/yell/adapters/datefile.rb', line 39 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.
28 29 30 |
# File 'lib/yell/adapters/datefile.rb', line 28 def symlink @symlink end |