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-2.7.0 lib/bolt/r10k_log_proxy.rb
bolt-2.6.0 lib/bolt/r10k_log_proxy.rb
bolt-2.5.0 lib/bolt/r10k_log_proxy.rb
bolt-2.4.0 lib/bolt/r10k_log_proxy.rb
bolt-2.3.1 lib/bolt/r10k_log_proxy.rb
bolt-2.3.0 lib/bolt/r10k_log_proxy.rb
bolt-2.2.0 lib/bolt/r10k_log_proxy.rb
bolt-2.1.0 lib/bolt/r10k_log_proxy.rb
bolt-2.0.1 lib/bolt/r10k_log_proxy.rb
bolt-2.0.0 lib/bolt/r10k_log_proxy.rb
bolt-1.49.0 lib/bolt/r10k_log_proxy.rb
bolt-1.48.0 lib/bolt/r10k_log_proxy.rb
bolt-1.47.0 lib/bolt/r10k_log_proxy.rb
bolt-1.45.0 lib/bolt/r10k_log_proxy.rb
bolt-1.44.0 lib/bolt/r10k_log_proxy.rb
bolt-1.43.0 lib/bolt/r10k_log_proxy.rb
bolt-1.42.0 lib/bolt/r10k_log_proxy.rb
bolt-1.41.0 lib/bolt/r10k_log_proxy.rb
bolt-1.40.0 lib/bolt/r10k_log_proxy.rb
bolt-1.39.0 lib/bolt/r10k_log_proxy.rb