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.25.0 lib/bolt/r10k_log_proxy.rb
bolt-2.24.1 lib/bolt/r10k_log_proxy.rb
bolt-2.24.0 lib/bolt/r10k_log_proxy.rb
bolt-2.23.0 lib/bolt/r10k_log_proxy.rb
bolt-2.22.0 lib/bolt/r10k_log_proxy.rb
bolt-2.21.0 lib/bolt/r10k_log_proxy.rb
bolt-2.20.0 lib/bolt/r10k_log_proxy.rb
bolt-2.19.0 lib/bolt/r10k_log_proxy.rb
bolt-2.18.0 lib/bolt/r10k_log_proxy.rb
bolt-2.17.0 lib/bolt/r10k_log_proxy.rb
bolt-2.16.0 lib/bolt/r10k_log_proxy.rb
bolt-2.15.0 lib/bolt/r10k_log_proxy.rb
bolt-2.14.0 lib/bolt/r10k_log_proxy.rb
bolt-2.13.0 lib/bolt/r10k_log_proxy.rb
bolt-2.12.0 lib/bolt/r10k_log_proxy.rb
bolt-2.11.1 lib/bolt/r10k_log_proxy.rb
bolt-2.11.0 lib/bolt/r10k_log_proxy.rb
bolt-2.10.0 lib/bolt/r10k_log_proxy.rb
bolt-2.9.0 lib/bolt/r10k_log_proxy.rb
bolt-2.8.0 lib/bolt/r10k_log_proxy.rb