Sha256: 91dcfc198415bf4d06307faf3f862153ae9cb13bd03123bb67c7a2463b81c4e8

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

module Puppet
class Server # :nodoc:
    class LoggerError < RuntimeError; end

    # Receive logs from remote hosts.
    class Logger < Handler
        @interface = XMLRPC::Service::Interface.new("puppetlogger") { |iface|
            iface.add_method("void addlog(string)")
        }

        # accept a log message from a client, and route it accordingly
        def addlog(message, client = nil, clientip = nil)
            # if the client is set, then we're not local
            if client
                begin
                    message = Marshal::load(CGI.unescape(message))
                    #message = message
                rescue => detail
                    raise XMLRPC::FaultException.new(
                        1, "Could not unMarshal log message from %s" % client
                    )
                end
            end

            # Mark it as remote, so it's not sent to syslog
            message.remote = true

            if client
                if ! message.source or message.source == "Puppet"
                    message.source = client
                end
            end

            Puppet::Log.newmessage(message)

            # This is necessary or XMLRPC gets all pukey
            return ""
        end
    end
end
end

# $Id: logger.rb 733 2005-10-28 21:28:59Z luke $

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puppet-0.9.2 lib/puppet/server/logger.rb