Sha256: 9277bd7de3125d43e6666ca09d2d56255466fbfdfbf3aef29cefad69d0f236fd

Contents?: true

Size: 574 Bytes

Versions: 3

Compression:

Stored size: 574 Bytes

Contents

# frozen_string_literal: true

require 'puppet/resource_api/base_context'

# Implement Resource API Conext to log through an IO object, defaulting to `$stderr`.
# There is no access to a device here. You can supply a transport if necessary.
class Puppet::ResourceApi::IOContext < Puppet::ResourceApi::BaseContext
  attr_reader :transport

  def initialize(definition, target = $stderr, transport = nil)
    super(definition)
    @target = target
    @transport = transport
  end

  protected

  def send_log(level, message)
    @target.puts "#{level}: #{message}"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
puppet-resource_api-1.9.0 lib/puppet/resource_api/io_context.rb
puppet-resource_api-1.8.18 lib/puppet/resource_api/io_context.rb
puppet-resource_api-1.8.14 lib/puppet/resource_api/io_context.rb