module Earl::Logger

Overview

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:

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.

Direct including types

Defined in:

logger.cr
logger/actor.cr
logger/backend.cr
logger/console_backend.cr
logger/severity.cr

Class Method Summary

Instance Method Summary

Class Method Detail

def self.backends : Array(Backend) #

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.


[View source]
def self.debug(agent : Agent, message : String) : Nil #

Logs message if .debug? returns true.


[View source]
def self.debug(agent : Agent, &block : -> String) : Nil #

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


[View source]
def self.debug? : Bool #

Returns true if the current level is DEBUG or lower.


[View source]
def self.error(agent : Agent, message : String) : Nil #

Logs message if .error? returns true.


[View source]
def self.error(agent : Agent, &block : -> String) : Nil #

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


[View source]
def self.error(agent : Agent, ex : Exception) #

[View source]
def self.error? : Bool #

Returns true if the current level is ERROR or lower.


[View source]
def self.info(agent : Agent, message : String) : Nil #

Logs message if .info? returns true.


[View source]
def self.info(agent : Agent, &block : -> String) : Nil #

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


[View source]
def self.info? : Bool #

Returns true if the current level is INFO or lower.


[View source]
def self.level : Severity #

[View source]
def self.level=(severity : Severity) : Severity #

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


[View source]
def self.silent? : Bool #

Returns true if the current level is SILENT.


[View source]
def self.warn(agent : Agent, message : String) : Nil #

Logs message if .warn? returns true.


[View source]
def self.warn(agent : Agent, &block : -> String) : Nil #

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


[View source]
def self.warn? : Bool #

Returns true if the current level is WARN or lower.


[View source]

Instance Method Detail

def log #

[View source]