Silva logging

Bug #100161 reported by Clemens Robbenhaar
12
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.declarePublic('log')
    def log(self, level, summary, detail='', error=None, reraise=None):
        """ forward to zLOG """
        if error:
            real_error = sys.exc_info()
        else:
            real_error = None
        # add the '\n' I allways forgot ...
        if detail and detail[0]!='\n':
            detail = '%s\n' % detail
        try:
            level=int(level)
        except:
            level = zLOG.ERROR
        zLOG.LOG('Silva', level, summary, detail, real_error, reraise)

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.

Tags: silva-future
Revision history for this message
Martijn Faassen (faassen) wrote :

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.

Revision history for this message
Martijn Faassen (faassen) wrote :

Moving along to Silva 0.9.4.

Changed in silva:
assignee: faassen → aaltepet
Revision history for this message
Sylvain Viollon (thefunny) wrote :

Please use the python module logging to log.

Changed in silva:
milestone: none → 2.3
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.