Class: Gitlab::QA::TestLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/qa/test_logger.rb

Overview

Common test logger implementation

Constant Summary collapse

TIME_FORMAT =
"%Y-%m-%d %H:%M:%S"
LEVEL_COLORS =
{
  "DEBUG" => :magenta,
  "INFO" => :green,
  "WARN" => :yellow,
  "ERROR" => :red,
  "FATAL" => :indianred
}.freeze

Class Method Summary collapse

Class Method Details

.logger(level: :info, source: 'Gitlab QA', path: 'tmp') ⇒ ActiveSupport::Logger

Combined logger instance

Parameters:

  • level (<Symbol, String>) (defaults to: :info)
  • source (String) (defaults to: 'Gitlab QA')

Returns:

  • (ActiveSupport::Logger)


28
29
30
31
32
33
# File 'lib/gitlab/qa/test_logger.rb', line 28

def logger(level: :info, source: 'Gitlab QA', path: 'tmp')
  console_log = console_logger(level: level, source: source)
  file_log = file_logger(source: source, path: path)

  console_log.extend(ActiveSupport::Logger.broadcast(file_log))
end