Sha256: 36a0a0a0a6adae62b80aac44950e53c18bb34dad345a8a4e8b4676fde6215d90

Contents?: true

Size: 737 Bytes

Versions: 94

Compression:

Stored size: 737 Bytes

Contents

# frozen_string_literal: true

require 'log4r/outputter/outputter'

module Bolt
  class R10KLogProxy < Log4r::Outputter
    def initialize
      super('bolt')

      @logger = Logging.logger[self]
    end

    def canonical_log(event)
      level = to_bolt_level(event.level)
      @logger.send(level, event.data)
    end

    # Convert an r10k log level to a bolt log level. These correspond 1-to-1
    # except that r10k has debug, debug1, and debug2. The log event has the log
    # level as an integer that we need to look up.
    def to_bolt_level(level_num)
      level_str = Log4r::LNAMES[level_num]&.downcase || 'debug'
      if level_str =~ /debug/
        :debug
      else
        level_str.to_sym
      end
    end
  end
end

Version data entries

94 entries across 94 versions & 1 rubygems

Version Path
bolt-1.38.0 lib/bolt/r10k_log_proxy.rb
bolt-1.37.0 lib/bolt/r10k_log_proxy.rb
bolt-1.36.0 lib/bolt/r10k_log_proxy.rb
bolt-1.35.0 lib/bolt/r10k_log_proxy.rb
bolt-1.34.0 lib/bolt/r10k_log_proxy.rb
bolt-1.33.0 lib/bolt/r10k_log_proxy.rb
bolt-1.32.0 lib/bolt/r10k_log_proxy.rb
bolt-1.31.1 lib/bolt/r10k_log_proxy.rb
bolt-1.31.0 lib/bolt/r10k_log_proxy.rb
bolt-1.30.1 lib/bolt/r10k_log_proxy.rb
bolt-1.30.0 lib/bolt/r10k_log_proxy.rb
bolt-1.29.1 lib/bolt/r10k_log_proxy.rb
bolt-1.29.0 lib/bolt/r10k_log_proxy.rb
bolt-1.28.0 lib/bolt/r10k_log_proxy.rb
bolt-1.27.1 lib/bolt/r10k_log_proxy.rb
bolt-1.27.0 lib/bolt/r10k_log_proxy.rb
bolt-1.26.0 lib/bolt/r10k_log_proxy.rb
bolt-1.25.0 lib/bolt/r10k_log_proxy.rb
bolt-1.24.0 lib/bolt/r10k_log_proxy.rb
bolt-1.23.0 lib/bolt/r10k_log_proxy.rb