class Crylog::CrylogLogger

Overview

Compatibility class to support using Crylog with the ::Logger type.

Defines Crylog::Logger logging methods as well as maps ::Logger::Severity methods to Crylog::Severity methods.

Crylog.configure do |registry|
  registry.register "main" do |logger|
    logger.handlers = [
      Crylog::Handlers::IOHandler.new STDOUT,
    ] of Crylog::Handlers::LogHandler
  end
end

one : ::Logger = Logger.new STDOUT
two : ::Logger = Crylog::CrylogLogger.new

one.warn "FOO" # => W, [2019-10-15 19:17:26 -04:00 #19986]  WARN -- : FOO
two.warn "FOO" # => [2019-10-15T23:17:26.042287000Z] main.WARNING: FOO

Defined in:

crylog_logger.cr

Constructors

Instance Method Summary

Macro Summary

Constructor Detail

def self.new(channel : String = Crylog.default_channel) #

Use the Crylog::Logger with the provided channel.


[View source]

Instance Method Detail

def alert(& : -> Crylog::MsgType) : Nil #

Logs message and optionally context with Crylog::Severity::Alert severity. Block is evaluated at least once due to https://github.com/crystal-lang/crystal/issues/8485.


[View source]
def alert(message, context : Crylog::LogContext? = nil) : Nil #

Logs message and optionally context with Crylog::Severity::Alert severity.


[View source]
def critical(& : -> Crylog::MsgType) : Nil #

Logs message and optionally context with Crylog::Severity::Critical severity. Block is evaluated at least once due to https://github.com/crystal-lang/crystal/issues/8485.


[View source]
def critical(message, context : Crylog::LogContext? = nil) : Nil #

Logs message and optionally context with Crylog::Severity::Critical severity.


[View source]
def debug(message, context : Crylog::LogContext? = nil) : Nil #

Logs message and optionally context with Crylog::Severity::Debug severity.


[View source]
def debug(& : -> Crylog::MsgType) : Nil #

Logs message and optionally context with Crylog::Severity::Debug severity. Block is evaluated at least once due to https://github.com/crystal-lang/crystal/issues/8485.


[View source]
def emergency(& : -> Crylog::MsgType) : Nil #

Logs message and optionally context with Crylog::Severity::Emergency severity. Block is evaluated at least once due to https://github.com/crystal-lang/crystal/issues/8485.


[View source]
def emergency(message, context : Crylog::LogContext? = nil) : Nil #

Logs message and optionally context with Crylog::Severity::Emergency severity.


[View source]
def error(message, context : Crylog::LogContext? = nil) : Nil #

Logs message and optionally context with Crylog::Severity::Error severity.


[View source]
def error(& : -> Crylog::MsgType) : Nil #

Logs message and optionally context with Crylog::Severity::Error severity. Block is evaluated at least once due to https://github.com/crystal-lang/crystal/issues/8485.


[View source]
def fatal(& : -> Crylog::MsgType) : Nil #

Logs message and optionally context with Crylog::Severity::Critical severity. Block is evaluated at least once due to https://github.com/crystal-lang/crystal/issues/8485.


[View source]
def fatal(message, context : Crylog::LogContext? = nil) : Nil #

Logs message and optionally context with Crylog::Severity::Critical severity.


[View source]
def info(& : -> Crylog::MsgType) : Nil #

Logs message and optionally context with Crylog::Severity::Info severity. Block is evaluated at least once due to https://github.com/crystal-lang/crystal/issues/8485.


[View source]
def info(message, context : Crylog::LogContext? = nil) : Nil #

Logs message and optionally context with Crylog::Severity::Info severity.


[View source]
def notice(& : -> Crylog::MsgType) : Nil #

Logs message and optionally context with Crylog::Severity::Notice severity. Block is evaluated at least once due to https://github.com/crystal-lang/crystal/issues/8485.


[View source]
def notice(message, context : Crylog::LogContext? = nil) : Nil #

Logs message and optionally context with Crylog::Severity::Notice severity.


[View source]
def unknown(message, context : Crylog::LogContext? = nil) : Nil #

Logs message and optionally context with Crylog::Severity::Debug severity.


[View source]
def unknown(& : -> Crylog::MsgType) : Nil #

Logs message and optionally context with Crylog::Severity::Debug severity. Block is evaluated at least once due to https://github.com/crystal-lang/crystal/issues/8485.


[View source]
def warn(message, context : Crylog::LogContext? = nil) : Nil #

Logs message and optionally context with Crylog::Severity::Warning severity.


[View source]
def warn(& : -> Crylog::MsgType) : Nil #

Logs message and optionally context with Crylog::Severity::Warning severity. Block is evaluated at least once due to https://github.com/crystal-lang/crystal/issues/8485.


[View source]
def warning(& : -> Crylog::MsgType) : Nil #

Logs message and optionally context with Crylog::Severity::Warning severity. Block is evaluated at least once due to https://github.com/crystal-lang/crystal/issues/8485.


[View source]
def warning(message, context : Crylog::LogContext? = nil) : Nil #

Logs message and optionally context with Crylog::Severity::Warning severity.


[View source]

Macro Detail

macro method_missing(call) #

[View source]