class Logger
def initialize(logdev, shift_age = 0, shift_size = 1048576, level: DEBUG,
Create an instance.
=== Description
Default is '%Y%m%d'.
The log file suffix format for +daily+, +weekly+ or +monthly+ rotation.
+shift_period_suffix+::
Use binary mode on the log device. Default value is false.
+binmode+::
Date and time format. Default value is '%Y-%m-%d %H:%M:%S'.
+datetime_format+::
Logging formatter. Default values is an instance of Logger::Formatter.
+formatter+::
Program name to include in log messages. Default value is nil.
+progname+::
Logging severity threshold. Default values is Logger::DEBUG.
+level+::
Integer). Defaults to +1048576+ (1MB).
Maximum logfile size in bytes (only applies when +shift_age+ is a positive
+shift_size+::
rotation.
+weekly+ or +monthly+). Default value is 0, which disables log file
Number of old log files to keep, *or* frequency of rotation (+daily+,
+shift_age+::
+File::NULL+ (same as +nil+).
+STDOUT+, +STDERR+, or an open file), +nil+ (it writes nothing) or
The log device. This is a filename (String), IO object (typically
+logdev+::
=== Args
Logger.new(logdev, datetime_format: '%Y-%m-%d %H:%M:%S')
Logger.new(logdev, formatter: formatter)
Logger.new(logdev, progname: 'progname')
Logger.new(logdev, level: :info)
Logger.new(logdev, shift_age = 'weekly')
Logger.new(logdev, shift_age = 0, shift_size = 1048576)
:call-seq:
def initialize(logdev, shift_age = 0, shift_size = 1048576, level: DEBUG, progname: nil, formatter: nil, datetime_format: nil, binmode: false, shift_period_suffix: '%Y%m%d') self.level = level self.progname = progname @default_formatter = Formatter.new self.datetime_format = datetime_format self.formatter = formatter @logdev = nil if logdev && logdev != File::NULL @logdev = LogDevice.new(logdev, shift_age: shift_age, shift_size: shift_size, shift_period_suffix: shift_period_suffix, binmode: binmode) end end