/usr/share/doc/ruby-log4r/examples/logclient.rb is in ruby-log4r 1.1.10-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # How to use RemoteOutputter. See logserver.rb first.
$: << File.join('..','lib')
require 'log4r'
require 'log4r/outputter/remoteoutputter'
include Log4r
Logger.new('log4r').add 'stdout' # to see what's going on inside
RemoteOutputter.new 'remote', # make a RemoteOutputter
:uri=>'tcpromp://localhost:9999', # where our LogServer is
:buffsize=>10 # buffer 10 before sending to LogServer
Logger.new('client').add('remote') # give 'remote' to a 'client' Logger
# we're done with setup, now let's log
def log(l)
l.debug "debugging"
l.info "a piece of info"
l.warn "Danger, Will Robinson, danger!"
l.error "I dropped by Wookie! :("
l.fatal "kaboom!"
end
5.times { log(Logger['client']) } # do a bunch of logging
Logger['client'].info "Bye Bye from client!"
Outputter['remote'].flush # flush the RemoteOutputter
|