class SimpLog::FileBackend
- SimpLog::FileBackend
- Log::Backend
- Reference
- Object
Overview
Provides a Log::Backend
that is backed with a log file that
supports automatic rotation, compression, and purging at specified
durations
Defined in:
simplog.crConstant Summary
-
DATETIME_FORMAT =
"%Y%m%d%H%M%S%3N"
-
Datetime pattern used to suffix rotated file names
-
DEFAULT_COMPRESS_AT =
7.days
-
Default compress duration: logs will be compress after 1 week
-
DEFAULT_DISPATCH_MODE =
::Log::DispatchMode::Async
-
Default
Log::DispatchMode
-
DEFAULT_GZIP_EXTENSION =
".gz"
-
Default file extension used for gzip compressed log files
-
DEFAULT_ROTATE_AT =
1.day
-
Default rotation duration: logs will be rotated after 1 day
Constructors
-
.new(formatter : Log::Formatter = ::Log::ShortFormat)
Creates a new LogFileBackend, filename should use .log extension for log retention to work correctly and use a directory dedicated to log files
-
.new(filename : String, formatter : Log::Formatter = ::Log::ShortFormat)
Creates a new LogFileBackend, filename should use .log extension for log retention to work correctly and use a directory dedicated to log files
Instance Method Summary
-
#compress_at : Time::Span
File age at which log files will be gzip compressed
-
#compress_at=(compress_at : Time::Span)
File age at which log files will be gzip compressed
-
#format(entry : Log::Entry) : Nil
Emits the entry to the current file.
-
#next_rotation_at : Time
When the next log file rotation is scheduled to occur
-
#retention : Time::Span | Nil
File age at which log files will be purged, if not set logs will be retained forever by default
-
#retention=(retention : Time::Span | Nil)
File age at which log files will be purged, if not set logs will be retained forever by default
-
#rotate_at : Time::Span
File age at which the current log file will be rotated
-
#rotate_at=(rotate_at : Time::Span) : Nil
Sets the age at which the log file will be rotated
-
#write(entry : Log::Entry) : Nil
Writes an entry to the log rotating the log file if required
Constructor Detail
Creates a new LogFileBackend, filename should use .log extension for log retention to work correctly and use a directory dedicated to log files
Creates a new LogFileBackend, filename should use .log extension for log retention to work correctly and use a directory dedicated to log files
Instance Method Detail
Emits the entry to the current file.
It uses the #formatter
to convert.
File age at which log files will be purged, if not set logs will be retained forever by default
File age at which log files will be purged, if not set logs will be retained forever by default