Class: Archfiend::Logging

Inherits:
Object
  • Object
show all
Defined in:
lib/archfiend/logging.rb,
lib/archfiend/logging/multi_logger.rb,
lib/archfiend/logging/base_formatter.rb,
lib/archfiend/logging/json_formatter.rb,
lib/archfiend/logging/default_formatter.rb

Defined Under Namespace

Classes: BaseFormatter, DefaultFormatter, JSONFormatter, MultiLogger

Constant Summary collapse

DEFAULT_FORMATTERS =
{
  file: 'JSONFormatter',
  stdout: 'DefaultFormatter'
}.freeze

Class Method Summary collapse

Class Method Details

.create(environment, log_directory, quiet = false) ⇒ MultiLogger

Returns A multiplexer for up to two loggers.

Parameters:

  • environment (String|Symbol)

    Current running environment, ex. :development

  • log_directory (String, Pathname)

    Directory in which the logfile is supposed to live

  • quiet (Boolean) (defaults to: false)

    Whether the STDOUT development output should be suppressed

Returns:

  • (MultiLogger)

    A multiplexer for up to two loggers



15
16
17
18
19
20
21
# File 'lib/archfiend/logging.rb', line 15

def create(environment, log_directory, quiet = false)
  environment = environment.to_sym
  loggers = [file_logger(environment, log_directory)]
  loggers << stdio_logger if environment == :development && !quiet

  MultiLogger.new(*loggers)
end