Sha256: ac0a69abee931e7603a47effcb10274a942569055f072d7de0929497a0960df4

Contents?: true

Size: 932 Bytes

Versions: 14

Compression:

Stored size: 932 Bytes

Contents

# frozen_string_literal: true

require 'logger'
require 'forwardable'
require'rainbow/refinement'

module Gitlab
  module QA
    module Runtime
      module Logger
        extend SingleForwardable
        using Rainbow

        def_delegators :logger, :debug, :info, :warn, :error, :fatal, :unknown

        singleton_class.module_eval do
          attr_writer :logger

          def logger
            Rainbow.enabled = Runtime::Env.colorized_logs?

            @logger ||= ::Logger.new($stdout).tap do |logger|
              logger.level = Runtime::Env.debug? ? ::Logger::DEBUG : ::Logger::INFO

              logger.formatter = proc do |severity, datetime, progname, msg|
                date_format = datetime.strftime("%Y-%m-%d %H:%M:%S")

                "[date=#{date_format} from=GitLab QA] #{severity.ljust(5)}-- ".yellow + "#{msg}\n"
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
gitlab-qa-7.24.3 lib/gitlab/qa/runtime/logger.rb
gitlab-qa-7.24.2 lib/gitlab/qa/runtime/logger.rb
gitlab-qa-7.24.1 lib/gitlab/qa/runtime/logger.rb
gitlab-qa-7.24.0 lib/gitlab/qa/runtime/logger.rb
gitlab-qa-7.23.1 lib/gitlab/qa/runtime/logger.rb
gitlab-qa-7.23.0 lib/gitlab/qa/runtime/logger.rb
gitlab-qa-7.22.1 lib/gitlab/qa/runtime/logger.rb
gitlab-qa-7.22.0 lib/gitlab/qa/runtime/logger.rb
gitlab-qa-7.21.1 lib/gitlab/qa/runtime/logger.rb
gitlab-qa-7.21.0 lib/gitlab/qa/runtime/logger.rb
gitlab-qa-7.20.0 lib/gitlab/qa/runtime/logger.rb
gitlab-qa-7.19.0 lib/gitlab/qa/runtime/logger.rb
gitlab-qa-7.18.1 lib/gitlab/qa/runtime/logger.rb
gitlab-qa-7.18.0 lib/gitlab/qa/runtime/logger.rb