module

Earl::Logger

Requires Earl.application to be started. Otherwise logged messages will hang the current program when the logger mailbox is full!

Extension module:

Include in agents to add a single #log method to access Log methods for the current agent. The methods eventually delegate to Logger class methods.

Configuration:

  • #level= —change the Severity level (default: Severity::INFO).
  • #backends —add or remove backends (default: ConsoleBackend).

The configuration may be changed at any time, but we advise to configure once before starting Earl.application.

Custom backends:

Custom backends must inherit from Backend and implement the Backend#write abstract method.

Class methods

backends

The list of currently enabled backends. Can be modified to add, remove or configure backends, but must be done before starting Earl.application.

Custom backends must inherit from Backend.

debug(agent : Agent, message : String) : Nil

Logs message if debug? returns true.

debug(agent : Agent, &block : -> String) : Nil

Logs the message returned by the block if debug? returns true, otherwise the block is never invoked.

debug?

Returns true if the current level is DEBUG or lower.

error(agent : Agent, message : String) : Nil

Logs message if error? returns true.

error(agent : Agent, &block : -> String) : Nil

Logs the message returned by the block if error? returns true, otherwise the block is never invoked.

error(agent : Agent, ex : Exception)
error?

Returns true if the current level is ERROR or lower.

info(agent : Agent, message : String) : Nil

Logs message if info? returns true.

info(agent : Agent, &block : -> String) : Nil

Logs the message returned by the block if info? returns true, otherwise the block is never invoked.

info?

Returns true if the current level is INFO or lower.

level
level=(severity : Severity) : Severity

Configures the severity level. Can be changed at any time.

silent?

Returns true if the current level is SILENT.

warn(agent : Agent, message : String) : Nil

Logs message if warn? returns true.

warn(agent : Agent, &block : -> String) : Nil

Logs the message returned by the block if warn? returns true, otherwise the block is never invoked.

warn?

Returns true if the current level is WARN or lower.

Instance methods

log

Nested types