Sha256: ce543fb4270e59aeb89bb7d9fbfabc3976bcd1fb93785459109af7367ec50290

Contents?: true

Size: 1.07 KB

Versions: 125

Compression:

Stored size: 1.07 KB

Contents

# 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

Version data entries

125 entries across 87 versions & 15 rubygems

Version Path
vagrant-unbundled-2.2.0.0 vendor/bundle/ruby/2.5.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-unbundled-2.1.4.0 vendor/bundle/ruby/2.5.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-unbundled-2.1.2.0 vendor/bundle/ruby/2.3.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-unbundled-2.1.1.0 vendor/bundle/ruby/2.5.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-unbundled-2.0.4.0 vendor/bundle/ruby/2.5.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-unbundled-2.0.3.0 vendor/bundle/ruby/2.5.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.4.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.5.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-unbundled-2.0.1.0 vendor/bundle/ruby/2.4.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-unbundled-2.0.0.1 vendor/bundle/ruby/2.4.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-unbundled-1.9.8.1 vendor/bundle/ruby/2.4.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-unbundled-1.9.7.1 vendor/bundle/ruby/2.4.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/gems/log4r-1.1.10/examples/rrsetup.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/gems/log4r-1.1.10/examples/rrsetup.rb