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