I was curious to hear what others reply - great discussion! I won't add
much to what was said, but I do want to emphasize a couple of points.
Logging is something that 9 people do in 10 ways. As such, leaving it to
everybody's whim will produce many incompatible logging styles, formats,
and mechanisms, which is untenable in any corporation that has
long-running programs on more than a few servers. I smile inside
thinking what logging would look like if everybody at Facebook decided
how to do their own logging on the many tens of thousands of running
servers.
You have already seen the value of standardizing on easy things that
everybody does differently - so that's why D has things such as version,
debug, and unittest as keywords. Most likely you have experienced
first-hand the outcome of leaving such simple policy decisions to the
whim of the user. It is easy to port that understanding and expertise to
a matter that is very similar even though you haven't experienced it
yourself.
One problem with logging is that it's one of those "pure design"
problems - it poses almost no algorithmic or systemic challenges. This
unfortunately creates an opportunity for overblown designs to come forth
and justify their own existence ("clearly you could do logging yourself
easily, but it would take you a long time to implement all of this
framework with all these features" etc), which in turn establishes a
ratchet mechanism that brings up ever more intricate, feature-full
designs.
That's why I'm saying: keep the logging library nice and simple and
never allow itself to take it too seriously.
Andrei
This is one thing people ignore or just purely don't understand,
Walter in this ng always say that pushing complexity to compiler/library
good thing
and to user is a bad thing. We all can see it is true, i assume?
For the case at hand, what would one expect from a logging library?
1 - 99% (i don't think this is an exaggeration) of the times, guess...
logging to specific level!
2 - 1% state changes and redirection.
What all if not most of the libraries out there want you to do?
Each time you need to use it :
You need to instantiate a logger object with, with level and file etc...
// %0-1 part
They sometimes go even further and want you call some internals... //
another %0-1 part
Then you need to do actual stuff... // yay! 99-100% part
If one call this a design, i got nothing to say :)
This is a good example of "one solution to every problem", "single
paradigm" sickness.
Thanks.
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/