Sha256: 3256f893284bc77ea9c3bad07e3bc02fb8e7d146014cbaa0aa90b1d96bb6dc6f

Contents?: true

Size: 684 Bytes

Versions: 11

Compression:

Stored size: 684 Bytes

Contents

# frozen_string_literal: true

Puppet::Util::Log.newdesttype :logging do
  match "Logging::Logger"

  # Bolt log levels don't match exactly with Puppet log levels, so we use
  # an explicit mapping.
  def initialize(logger)
    @external_logger = logger

    @log_level_map = {
      debug: :debug,
      info: :info,
      notice: :notice,
      warning: :warn,
      err: :error,
      # Nothing in Puppet actually uses alert, emerg or crit, so it's hard to say
      # what they indicate, but they sound pretty bad.
      alert: :error,
      emerg: :fatal,
      crit: :fatal
    }
  end

  def handle(log)
    @external_logger.send(@log_level_map[log.level], log.to_s)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
bolt-0.21.3 lib/bolt/pal/logging.rb
bolt-0.21.2 lib/bolt/pal/logging.rb
bolt-0.21.1 lib/bolt/pal/logging.rb
bolt-0.21.0 lib/bolt/pal/logging.rb
bolt-0.20.7 lib/bolt/pal/logging.rb
bolt-0.20.6 lib/bolt/pal/logging.rb
bolt-0.20.5 lib/bolt/pal/logging.rb
bolt-0.20.3 lib/bolt/pal/logging.rb
bolt-0.20.2 lib/bolt/pal/logging.rb
bolt-0.20.0 lib/bolt/pal/logging.rb
bolt-0.19.1 lib/bolt/pal/logging.rb