Class: Yell::Adapters::Datefile

Inherits:
File show all
Defined in:
lib/yell/adapters/datefile.rb

Overview

The Datefile adapter is similar to the File adapter. However, it rotates the file at midnight.

Constant Summary collapse

DefaultDatePattern =

The default date pattern, e.g. “19820114” (14 Jan 1982)

"%Y%m%d"
Metadata =

Metadata

lambda { |date, pattern| "# -*- #{date.iso8601} (#{date.to_f}) [#{pattern}] -*-" }
MetadataRegexp =
/^# -\*- (.+) \((\d+\.\d+)\) \[(.+)\] -\*-$/

Constants inherited from Io

Io::Colors

Instance Attribute Summary collapse

Attributes inherited from Io

#colors

Attributes included from Formatter::Helpers

#format

Attributes included from Level::Helpers

#level

Method Summary

Methods inherited from Io

#colorize!

Methods inherited from Base

#close, close, #initialize, setup, write, #write

Constructor Details

This class inherits a constructor from Yell::Adapters::Base

Instance Attribute Details

#date_patternObject

The pattern to be used for the files

Examples:

date_pattern = "%Y%m%d"       # default
date_pattern = "%Y-week-%V"


59
60
61
# File 'lib/yell/adapters/datefile.rb', line 59

def date_pattern
  @date_pattern
end

#keepObject

Set the amount of logfiles to keep when rolling over. By default, no files will be cleaned up.

Examples:

Keep the last 5 logfiles

keep = 5
keep = '10'

Do not clean up any files

keep = 0


78
79
80
# File 'lib/yell/adapters/datefile.rb', line 78

def keep
  @keep
end

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.

Examples:

symlink = true


67
68
69
# File 'lib/yell/adapters/datefile.rb', line 67

def symlink
  @symlink
end