Source line number for log purpose (newbie)
Siggy Brentrup
bsb at baal.infodrom.north.de
Sat Sep 25 21:14:23 EDT 1999
François Pinard <pinard at iro.umontreal.ca> writes:
> [1 <text/plain>]
> Siggy Brentrup <bsb at baal.infodrom.north.de> writes:
>
> > It's easy, feel free to use the attached code (quoted-printable to get
> > tabs right)
>
> Last week, I did something a bit more elaborate, but based on the same
> trick. The problem is that between the interesting source line and the
> diagnostic, there might be a chain of intermediate routine calls, showing
> no real interest. You'll find the code below. I use it through:
Nice work, mine was only a quick 'n dirty sample for a newbie.
> Report.oops(format, args...)
>
> like calls, from a bit everywhere in my code. Each `def foo()...'
> which is uninteresting for diagnostic purposes has the following line:
>
> Report.untangible(foo)
>
> after it, before the next `def'.
Just another idea: abuse a functions __doc__ string
def you_wont_want_to_see_me():
"""reported above level N"""
return interesting()
Pursuing this idea you can get immune against name clashes across
modules.
> I made some effort to get a very legible log. All successive log lines
> issued from within the same interesting spot in the program have the program
> location suppressed, but the margin preserved. The program location is
> repeated in full when the line change. Moreover, if another set of log
> lines come from another module, an extra white line is added for grouping.
>
> The few French comments should not create any problem, I guess.
Not a major problem, in school I was better in french than in english,
(cause liked Sartre and Camus better than Shakespeare I guess)
> [2 Report.py <application/octet-stream>]
# Services diagnostiques.
# Copyright © 1998, 1999 Progiciels Bourbeau-Pinard inc.
# François Pinard <pinard at iro.umontreal.ca>, 1998.
Btw, do you grant permission to use, copy and modify ...?
CU
Siggy
--
noch nichts Aufregendes:
Siggy Brentrup - bsb at baal.infodrom.north.de - voice: +49-441-6990134
More information about the Python-list
mailing list