Sha256: 41cbf537389207062c6311ad8db0c11e098991bd98a0b9c8c2714f4799d36ec7

Contents?: true

Size: 1.16 KB

Versions: 24

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

require 'bolt/util/format'

# Log a debugging message.
#
# Messages logged at this level typically include detailed information about
# what a plan is doing. For example, you might log a message at the `debug`
# level that shows what value is returned from a function invocation.
#
# See [Logs](logs.md) for more information about Bolt's log levels.
#
# > **Note:** Not available in apply block
Puppet::Functions.create_function(:'log::debug') do
  # Log a debugging message.
  # @param message The message to log.
  # @example Log a debugging message
  #   log::debug("Function frogsay returned: ${result}")
  dispatch :log_debug do
    param 'Any', :message
    return_type 'Undef'
  end

  def log_debug(message)
    unless Puppet[:tasks]
      raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
        Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING,
        action: 'log::debug'
      )
    end

    Puppet.lookup(:bolt_executor).tap do |executor|
      executor.report_function_call(self.class.name)
      executor.publish_event(type: :log, level: :debug, message: Bolt::Util::Format.stringify(message))
    end

    nil
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
bolt-4.0.0 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.29.0 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.28.0 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.27.4 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.27.2 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.27.1 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.26.2 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.26.1 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.25.0 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.24.0 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.23.1 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.23.0 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.22.1 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.22.0 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.21.0 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.20.0 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.19.0 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.18.0 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.17.0 bolt-modules/log/lib/puppet/functions/log/debug.rb
bolt-3.16.1 bolt-modules/log/lib/puppet/functions/log/debug.rb