Logging 1.5.0

logging version 1.5.0
by Tim P.
logging | RubyGems.org | your community gem host

== DESCRIPTION

Logging is a flexible logging library for use in Ruby programs based on
the
design of Java’s log4j library. It features a hierarchical logging
system,
custom level names, multiple output destinations per log event, custom
formatting, and more.

== CHANGES

Minor Enhancements

  • removed mutexes in favor of IO#syswrite
  • no round tripping through the buffer array when auto_flushing is true
  • added a Proxy object that will log all methods called on it
  • colorization of log messages

logging version 1.5.0

Why might one prefer it over log4r?

Any interesting optimizations similar to parameterized messages of
http://www.slf4j.org/faq.html#logging_performance

  • colorization of log messages

Does this work on Windows? May need to use
http://adoxa.110mb.com/ansicon/index.html

Jon

Smoke test with https://gist.github.com/887180 looks good…installing
to jruby and all my mri rubies.

http://db.tt/lohuuFs

Thanks for the details and the project!

Jon

Off-topic, but Ansicon is awesome. :slight_smile: It has made my Windows-Ruby life
immeasurably more usable. That should be built-in to DevKit or
something.

-Nick K.

On Mar 25, 2011, at 7:28 AM, Jon F. wrote:

logging version 1.5.0

Why might one prefer it over log4r?

Logging was created when log4r was abandoned. I tried contacting the
original log4r developer many years ago and never received a response;
therefore I started the logging project. As a side note, this led to an
interesting discussion on how to handle abandoned projects on rubyforge.

There is a “benchmark.rb” file in the test directory that compares the
performance of logging, log4r, and the core ruby logger. It is a very
simple benchmark, but logging outperforms the others in all the tests
except for one (in that case the core ruby logger wins but just barely).

Any interesting optimizations similar to parameterized messages of
SLF4J FAQ

All those tricks apply. With the logging gem you can specify how general
ruby objects are formatted: string, inspect, or yaml. When you log a
general object then …

Logging.format_as(:inspect)
ary = [1, 2, 3, ‘four’, ‘five’, ‘six’]
logger.info(ary)

The array will be printed out in the form

[1, 2, 3, “four”, “five”, “six”]

  • colorization of log messages

Does this work on Windows? May need to use
http://adoxa.110mb.com/ansicon/index.html

Colorization inserts ANSI terminal codes into the log messages. I have
not tested it on windows with ansicon. However, if ansicon is truly
compliant then it should work just fine.

Good questions! I hope the answers were equally good.

Blessings,
TwP