Writes the given msg
to the log with no formatting; returns the number of characters written, or nil
if no log device exists:
logger = Logger.new($stdout) logger << 'My message.' # => 10
Output:
My message.
Equivalent to calling add
with severity Logger::DEBUG
.
Equivalent to calling add
with severity Logger::INFO
.
Equivalent to calling add
with severity Logger::WARN
.
Equivalent to calling add
with severity Logger::FATAL
.
Equivalent to calling add
with severity Logger::UNKNOWN
.
Returns the internal Syslog
object that is initialized when the first instance is created.
Specifies the internal Syslog
object to be used.
Logs a message
at the error (syslog warning) log level, or logs the message returned from the block.
Adjust the log level during the block execution for the current Fiber
only
logger.with_level(:debug) do logger.debug { "Hello" } end
Sets the date-time format.
Argument datetime_format
should be either of these:
A string suitable for use as a format for method Time#strftime
.
nil
: the logger uses '%Y-%m-%dT%H:%M:%S.%6N'
.
Returns the date-time format; see datetime_format=
.
Logs a message
at the unknown (syslog alert) log level, or logs the message returned from the block.
Logs a message
at the fatal (syslog err) log level, or logs the message returned from the block.
Logs a message
at the warn (syslog notice) log level, or logs the message returned from the block.
Logs a message
at the info (syslog info) log level, or logs the message returned from the block.
Logs a message
at the debug (syslog debug) log level, or logs the message returned from the block.