Auditor

class
Superclass
Symphony::Task

A spike to log events

Public Class Methods

anchor
new( * )

Create a new Auditor task.

# File lib/symphony/tasks/auditor.rb, line 20
def initialize( * )
        super
        @logdir = Pathname.pwd
        @logfile = @logdir + 'events.log'
        @log = @logfile.open( File::CREAT|File::APPEND|File::WRONLY, encoding: 'utf-8' )
        self.log.info "Logfile is: %s" % [ @logfile ]
end

Public Instance Methods

anchor
work( payload, metadata )

Log the event.

# File lib/symphony/tasks/auditor.rb, line 38
def work( payload, metadata )
        @log.puts "%d%s [%s]: %p" % [
                metadata[:delivery_info][:delivery_tag],
                metadata[:delivery_info][:redelivered] ? '+' : '',
                metadata[:delivery_info][:routing_key],
                payload
        ]

        return true
end