Class: ChupaText::DefaultLogger

Inherits:
Logger
  • Object
show all
Defined in:
lib/chupa-text/default-logger.rb

Overview

The default logger for ChupaText. Logger options are retrieved from environment variables.

Here are environment variables to be used:

CHUPA_TEXT_LOG_OUTPUT

It specifies log output.

  • -: ChupaText outputs to the standard output.
  • +: ChupaText outputs to the standard error output.
  • Others: It is used as file name. ChupaText outputs to the file.

The default is + (the standard error).

CHUPA_TEXT_LOG_ROTATION_PERIOD

It specifies log rotation period.

It is ignored when CHUPA_TEXT_LOG_OUTPUT is - (the standard output) or + (the standard error output).

  • daily: Log file is rotated daily.
  • weekly: Log file is rotated weekly.
  • monthly: Log file is rotated monthly.
  • Others: Invalid value. It is ignored.

CHUPA_TEXT_LOG_N_GENERATIONS

It specifies how many old log files are kept.

It is ignored when (a) CHUPA_TEXT_LOG_OUTPUT is - (the standard output) or + (the standard error output) or (b) CHUPA_TEXT_LOG_RATATION_PERIOD is valid value.

The default value is 7.

CHUPA_TEXT_LOG_LEVEL

It specifies log verbosity.

The default value is info.

  • unknown: ChupaText outputs only unknown messages.
  • fatal: ChupaText outputs unknown level messages and unhandleable error messages.
  • error: ChupaText outputs fatal level messages and handleable error messages.
  • warn: ChupaText outputs error level messages and warning level messages.
  • info: ChupaText outputs warn level messages and generic useful information messages.
  • debug: ChupaText outputs all messages.

Defined Under Namespace

Classes: Formatter

Instance Method Summary collapse

Constructor Details

#initializeDefaultLogger

Returns a new instance of DefaultLogger.



74
75
76
77
78
# File 'lib/chupa-text/default-logger.rb', line 74

def initialize
  super(output_device, default_shift_age, default_shift_size)
  self.level = default_level
  self.formatter = Formatter.new
end