Class: GitlabQuality::TestTooling::Runtime::Logger
- Inherits:
-
Object
- Object
- GitlabQuality::TestTooling::Runtime::Logger
- Extended by:
- SingleForwardable
- Defined in:
- lib/gitlab_quality/test_tooling/runtime/logger.rb
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
-
.logger(source: 'Gitlab QA') ⇒ ActiveSupport::Logger
Combined logger instance.
Class Method Details
.logger(source: 'Gitlab QA') ⇒ ActiveSupport::Logger
Combined logger instance
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/gitlab_quality/test_tooling/runtime/logger.rb', line 33 def logger(source: 'Gitlab QA') @logger ||= begin log_path = Env.log_path ::FileUtils.mkdir_p(log_path) console_log = console_logger(source: source, level: Env.log_level) file_log = file_logger(source: source, path: log_path) if ActiveSupport.const_defined?(:BroadcastLogger) # only available in ActiveSupport >= 7.1.0 ActiveSupport::BroadcastLogger.new(console_log, file_log, file_log) else console_log.extend(ActiveSupport::Logger.broadcast(file_log)) end end end |