From: Leon Torres Date: 2002-01-17T20:01:28+09:00 Subject: [ANN] Log4r 1.0.0 - Logging library for Ruby update Log4r is an extremely flexible logging library for Ruby that was inspired by Apache Log4j, but is no longer a copycat. In this version, I've added a few features and broke backward compatibility a tiny bit. About: http://log4r.sourceforge.net/ Download: http://sourceforge.net/project/showfiles.php?group_id=43396 Notable Changes: * Nice XML configuration with REXML * Introducing the powerful PatternFormatter: pattern="[%d %l] %.15m" => [2001-01-16 13:40:41 DEBUG] Message * Lots of documentation and examples with better organization. * Nice logo! :-) Let me bribe you with an example.rb: reuire 'log4r' include Log4r Configurator.custom_levels :TODO, :DEBUG, :ERROR mylog = Logger.new('mylog') mylog.outputters = Outputter.stdout mylog.trace = true pf = PatternFormatter.new :pattern => "%5l [%d] %t: %.25M", :date_pattern => "%H:%M:%S" Outputter.stdout.formatter = pf # do some logging mylog.todo "This is a TODO message" mylog.debug ((1..100).to_a) if mylog.debug? mylog.error "I dropped my Wookie!" puts "-= Changing the level to ERROR dynamically. =-" mylog.level = ERROR # filter out TODO and DEBUG mylog.todo "This won't show up" mylog.debug ((1..100).to_a) if mylog.debug? # array won't get created mylog.error "This will show up" The above script produces: TODO [02:32:23] example.rb in 15: This is a TODO message DEBUG [02:32:23] example.rb in 16: Array: [1, 2, 3, 4, 5, 6, ERROR [02:32:23] example.rb in 17: I dropped my Wookie! -= Changing the level to ERROR dynamically. =- ERROR [02:32:23] example.rb in 23: This will show up Isn't that sweet? Log4r has a lot more to offer, so please take a look! - Leon