A generic logging class

Constants

Fatal log level which indicates a server crash

Error log level which indicates a recoverable error

Warning log level which indicates a possible problem

Information log level which indicates possibly useful information

Debugging error level for messages used in server development or debugging

Attributes
Read & Write

log-level, messages above this level will be logged

Class Methods

Initializes a new logger for log_file that outputs messages at level or higher. log_file can be a filename, an IO-like object that responds to << or nil which outputs to $stderr.

If no level is given INFO is chosen by default

Instance Methods

Synonym for log(INFO, obj.to_s)

Closes the logger (also closes the log device associated to the logger)

Shortcut for logging a DEBUG message

Will the logger output DEBUG messages?

Shortcut for logging an ERROR message

Will the logger output ERROR messages?

Shortcut for logging a FATAL message

Will the logger output FATAL messages?

Formats arg for the logger

  • If arg is an Exception, it will format the error message and the back trace.

  • If arg responds to to_str, it will return it.

  • Otherwise it will return arg.inspect.

Shortcut for logging an INFO message

Will the logger output INFO messages?

Logs data at level if the given level is above the current log level.

Shortcut for logging a WARN message

Will the logger output WARN messages?