On Thu, Dec 9, 2010 at 4:49 AM, Paul Moore <p.f.mo...@gmail.com> wrote:
> On 8 December 2010 14:52, Nick Coghlan <ncogh...@gmail.com> wrote:
>> As I see it, there aren't many cases at the *library* level where
>> logging errors is more appropriate than raising exceptions:
>
> On a slightly tangential note, what do you think of the idea of
> library code including info or debug level logging? In effect, tracing
> and diagnostic code built in and available simply by changing the
> logging level?

It's a trade-off between performance and the ability to diagnose
faults and what you want to do will vary by application and problem
domain. My background is in working on distributed projects where we
need enough diagnostic information to debug one-off failures of the
live system, so I'm in favour of the idea in general, but doing it
*can* carry a fairly hefty speed cost (you can ameliorate that to some
degree by handing off the actual I/O to a separate thread, but the
system would still be faster if the log messages weren't there).

As Skip says, you definitely want to take advantage of the lazy string
formatting when doing this with the Python logging module.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to