class Logger

def add(severity, message = nil, progname = nil)


- #unknown.
- #fatal.
- #error.
- #warn.
- #info.
- #debug.

These convenience methods have implicit severity:

E, [2022-05-12T16:26:35.841134 #36328] ERROR -- gnum: No good
E, [2022-05-12T16:25:55.349414 #36328] ERROR -- mung: No good
I, [2022-05-12T16:25:31.469726 #36328] INFO -- mung: mung

Output:

logger.add(Logger::ERROR, 'No good', 'gnum')
logger.add(Logger::ERROR, 'No good')
logger.add(Logger::INFO)
logger = Logger.new($stdout, progname: 'mung')

Examples:

and {Entries}[rdoc-ref:Logger@Entries] for details.
See {Log Level}[rdoc-ref:Logger@Log+Level]
depending on the entry's severity and on the log level.
Creates a log entry, which may or may not be written to the log,
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