Silva logging
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Silva |
Invalid
|
Wishlist
|
Andy Altepeter |
Bug Description
Martijn asked to open a new issue, thus here it is ;)
I guessed it would be nice to have some logging within Silva
which is easily available. This is mostly for debugging.
Maybe there is some other usage I have not thought about.
I actually have some test code in my local version of SilvaObject.py:
security.
def log(self, level, summary, detail='', error=None, reraise=None):
""" forward to zLOG """
if error:
else:
# add the '\n' I allways forgot ...
if detail and detail[0]!='\n':
detail = '%s\n' % detail
try:
except:
level = zLOG.ERROR
This allows to add a log line even in a script, saying something like:
node.log(0, 'test log')
The disadvantage is one has to set the log-level explicitly (the
zero in the above line), but I did neither want to write a "debug(...)",
"info(...)" ... method nor include the zLOG.BLATHER, zLOG.INFORMATION,
etc. as SilvaObject attributes.
The optional fourth argument is not a traceback object, but only some
boolean value; I guessed it would be enough to flag if one wants the
current traceback. (Especially as one does not have access to "sys" in
scripts.)
If something like this is meant to be useful in general, one _maybe_
should not make the "log" method public available ;-)
P.S. I nosed in nearly everybody but jw as he is maybe quite overbusy
anyway. (Or should I nose him in, too?)
Feel free to nose out, of course.
Changed in silva: | |
assignee: | faassen → aaltepet |
Silva logging would be nice. Best woudl be to make use of whatever is the
most up to date Zope/Python logging infrastructure. Want to do this by the
Silva 0.9.3 era.