fine grain logging cotrol
Eric S. Johansson
esj at harvee.org
Sun Mar 25 00:21:26 CET 2007
Dennis Lee Bieber wrote:
> I've never resorted to the debugger -- it's always been faster for
> me to just wolf-fence* code with print statements...
depends on the situation for me. normally I use log statements that
turn on or off based on predicates (now I need to figure out how to
handle a SIGUSR1 to reload the who-logs info) hence this quest. when
done it's going into my rcsoc (random cross section of code) collection
which I'll publish one of these days. Also, I need to see if I can make
this lower overhead by pre computing as much of the predicate term as
possible and perform the test before calling a log statement. I put in
*lots* of log statements but leave most of them off until needed.
different form of wolf fence.
> Could you possibly be confusing the execution of the "def"
> statement... Remember, in Python "class" and "def" are executable
> statements themselves. That is, what you are seeing during __new__ is
> the execution of the statement that defines the get_logger method, NOT a
> call of get_logger itself.
I know def executes. forth plays similar games and I spent a *lot* of
time in the guts of forth. With python, I'm just not familiar enough
with what goes on beneath the sheets.
> Ah.. Okay... the wolf howled... Looking deeper at the code, it is
> not a direct call to get_logger, but an indirect one via the dictionary
right. still not comfortable the property call. if I'm reading the
right docs, the first arg is a get method and I'm not sure how a logger
fills that need.
> None the less, your posted code did have too many _ on the init,
> meaning the initialization never took place, AND the references to
> "test_names" needs to be prefixed with "self."
my most common brain fades. I also miss tt/ttt, ss/sss, 1l and
probably a few others. I sometimes think IDE's should have a "did you
mean" function to alert you to stuff that's "almost" right. kind of
like the lisp programmer's assistant.
More information about the Python-list