/usr/share/doc/ruby-log4r/examples/rrsetup.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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # This is a real config file used by a game that I'm working on
# The XML config file is called rrconfig.xml
$: << File.join('..','lib')
require 'log4r'
require 'log4r/configurator'
include Log4r
# How to format component data - low noise
class CompFormatter < Formatter
def format(event)
buff = event.name + "> "
if event.data.kind_of?(String) then buff += event.data
else buff += event.data.inspect end
return buff + "\n"
end
end
# Set the logpath. Eventually, this will be determined from the environment.
Configurator['logpath'] = './logs'
Configurator.load_xml_file('rrconfig.xml')
# the rest is an example
Robot = {"name"=>"twonky", "row"=>"3", "col"=>"4"}
def do_logging(log)
log.comp3 Robot
log.comp2 Robot
log.comp1 Robot
log.data "this is a piece of data".split
log.debug "debugging"
log.info "a piece of info"
log.warn "Danger, Will Robinson, danger!"
log.error "I dropped my Wookie! :("
log.fatal "kaboom!"
end
Logger.each_logger {|logger| do_logging(logger)}
# you can see the results onscreen and in logs/game.log
# logs/data.log and logs/component.log
|