Sha256: 26c027775142a6278db4a786926bca48acc9ab9feb3688c87cb9dd5092e9a9ce

Contents?: true

Size: 905 Bytes

Versions: 2

Compression:

Stored size: 905 Bytes

Contents

# How to use RemoteOutputter. See logserver.rb first.

$: << File.join('..','lib')
require 'log4r-color'
require 'log4r-color/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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
log4r-color-1.2.2 examples/logclient.rb
log4r-color-1.2 examples/logclient.rb