[Python-ideas] Efficient debug logging

Chris Angelico rosuav at gmail.com
Wed Feb 15 06:48:59 EST 2017


On Wed, Feb 15, 2017 at 10:47 PM, Barry Scott <barry at barrys-emacs.org> wrote:
> __repr__ is interesting however.
>
> Typically I describe in a string why the value is being logged. That means
> that the object is always a string. I cannot recall using debugLog( obj )
> in production.
>
> dlog('This is the state of obj at the start of event processing: %r' % (obj,))

Right. I would have no hesitation whatsoever in dumping out a crucial
state object, even if it means writing a custom (and expensive) repr
function for it. It's clean, simple, and immensely helpful in
debugging.

ChrisA


More information about the Python-ideas mailing list