class Logger
def add(severity, message = nil, progname = nil)
* If the OS supports multi I/O, records possibly may be mixed.
* Append open does not need to lock file.
* Logfile is not locked.
=== Bugs
implementation if required.
including message, class, and backtrace. See #msg2str for the
A special case is an +Exception+ object, which will be printed in detail,
if the given object is not a String.
converted to a String in order to log it. Generally, +inspect+ is used
Message format: +message+ can be any object, but it has to be
#error, and #fatal.
logging method. Users will be more inclined to use #debug, #info, #warn,
Log a message if the given severity is high enough. This is the generic
=== Description
log no message, and return +true+.
When the given severity is not high enough (for this particular logger),
=== Return
Can be omitted. Called to get a message string if +message+ is nil.
+block+::
+message+ and +block+ are given.
Program name string. Can be omitted. Treated as a message if no
+progname+::
The log message. A String or Exception.
+message+::
+WARN+, +ERROR+, +FATAL+, or +UNKNOWN+.
Severity. Constants are defined in Logger namespace: +DEBUG+, +INFO+,
+severity+::
=== Args
Logger#add(severity, message = nil, progname = nil) { ... }
:call-seq:
def add(severity, message = nil, progname = nil) severity ||= UNKNOWN if @logdev.nil? or severity < @level return true end if progname.nil? progname = @progname end if message.nil? if block_given? message = yield else message = progname progname = @progname end end @logdev.write( format_message(format_severity(severity), Time.now, progname, message)) true end