Module: Kitchen::Logging

Overview

Mixin module that delegates logging methods to a local ‘#logger`.

Author:

Instance Method Summary collapse

Instance Method Details

Log a message with severity of banner

Parameters:

  • message_or_progname (#to_s)

    the message to log. In the block form, this is the progname to use in the log message.

Yields:

  • evaluates to the message to log. This is not evaluated unless the logger’s level is sufficient to log the message. This allows you to create potentially expensive logging messages that are only called when the logger is configured to show them.

Returns:

  • (nil, true)

    when the given severity is not high enough (for this particular logger), log no message, and return true



45
# File 'lib/kitchen/logging.rb', line 45

logger_method :banner

#debug { ... } ⇒ nil, true

Log a message with severity of debug

Parameters:

  • message_or_progname (#to_s)

    the message to log. In the block form, this is the progname to use in the log message.

Yields:

  • evaluates to the message to log. This is not evaluated unless the logger’s level is sufficient to log the message. This allows you to create potentially expensive logging messages that are only called when the logger is configured to show them.

Returns:

  • (nil, true)

    when the given severity is not high enough (for this particular logger), log no message, and return true



46
# File 'lib/kitchen/logging.rb', line 46

logger_method :debug

#error { ... } ⇒ nil, true

Log a message with severity of error

Parameters:

  • message_or_progname (#to_s)

    the message to log. In the block form, this is the progname to use in the log message.

Yields:

  • evaluates to the message to log. This is not evaluated unless the logger’s level is sufficient to log the message. This allows you to create potentially expensive logging messages that are only called when the logger is configured to show them.

Returns:

  • (nil, true)

    when the given severity is not high enough (for this particular logger), log no message, and return true



49
# File 'lib/kitchen/logging.rb', line 49

logger_method :error

#fatal { ... } ⇒ nil, true

Log a message with severity of fatal

Parameters:

  • message_or_progname (#to_s)

    the message to log. In the block form, this is the progname to use in the log message.

Yields:

  • evaluates to the message to log. This is not evaluated unless the logger’s level is sufficient to log the message. This allows you to create potentially expensive logging messages that are only called when the logger is configured to show them.

Returns:

  • (nil, true)

    when the given severity is not high enough (for this particular logger), log no message, and return true



50
# File 'lib/kitchen/logging.rb', line 50

logger_method :fatal

#info { ... } ⇒ nil, true

Log a message with severity of info

Parameters:

  • message_or_progname (#to_s)

    the message to log. In the block form, this is the progname to use in the log message.

Yields:

  • evaluates to the message to log. This is not evaluated unless the logger’s level is sufficient to log the message. This allows you to create potentially expensive logging messages that are only called when the logger is configured to show them.

Returns:

  • (nil, true)

    when the given severity is not high enough (for this particular logger), log no message, and return true



47
# File 'lib/kitchen/logging.rb', line 47

logger_method :info

#warn { ... } ⇒ nil, true

Log a message with severity of warn

Parameters:

  • message_or_progname (#to_s)

    the message to log. In the block form, this is the progname to use in the log message.

Yields:

  • evaluates to the message to log. This is not evaluated unless the logger’s level is sufficient to log the message. This allows you to create potentially expensive logging messages that are only called when the logger is configured to show them.

Returns:

  • (nil, true)

    when the given severity is not high enough (for this particular logger), log no message, and return true



48
# File 'lib/kitchen/logging.rb', line 48

logger_method :warn