Sha256: 6fe5e3735a7e17b89f580fe28cb709f62cd05fec0af2b81bc6273bba9a0e4af8
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
# Here's how to start using log4r right away $LOAD_PATH << File.join(File.dirname(__FILE__), "..", "/lib") require "log4r" require "log4r/logstash" require "securerandom" Log = Log4r::Logger.new("outofthebox") # create a logger Log.add Log4r::Outputter.stderr # which logs to stdout r = SecureRandom.uuid additional_fields = {} additional_fields["foo"] = "bar" additional_fields["goo"] = "baz" additional_fields["random"] = -> { r } Log.add Log4r::Logstash::RedisOutputter.new("redis", data_field_name: "Message", level_field_name: "Level", additional_fields: additional_fields) # do some logging def do_logging 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 do_logging # now let's filter anything below WARN level (DEBUG and INFO) puts "-= Changing level to WARN =-" Log.level = Log4r::WARN do_logging
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
log4r-logstash-0.1.1 | examples/redis.rb |
log4r-logstash-0.1.0 | examples/redis.rb |