| Home | Trees | Indices | Help |
|
|---|
|
|
1 # 2 # Copyright (c) 2008 rPath, Inc. 3 # 4 # This program is distributed under the terms of the Common Public License, 5 # version 1.0. A copy of this license should have been distributed with this 6 # source file in a file called LICENSE. If it is not present, the license 7 # is always available at http://www.rpath.com/permanent/licenses/CPL-1.0. 8 # 9 # This program is distributed in the hope that it will be useful, but 10 # without any warranty; without even the implied warranty of merchantability 11 # or fitness for a particular purpose. See the Common Public License for 12 # full details. 13 # 14 15 16 import logging 17 18 from conary.lib import logger 1921 """Xml logging class compatible with python's built in logging structures. 22 23 This class defines an interface to logger.XmlWriter that's compatible 24 with python's logging module. Note that logger.XmlWriter expects to write 25 a complete log from start to finish. This is because it attempts to produce 26 well formed XML. It also employs some compression filters that don't 27 define an append mode, so not allowing append is more consistent. This 28 deviates from normal python logging assumptions. Use with caution."""5630 stream = logger.XmlLogWriter(path) 31 stream.start() 32 logging.StreamHandler.__init__(self, stream)33 3840 # by forcing a newline as a separate even we ensure that all newlines 41 # in the log message will be present but escaped and we will have one 42 # line per logging event 43 self.stream.log(record.getMessage(), record.levelname)4446 return self.stream.pushDescriptor(descriptor)4749 return self.stream.popDescriptor(descriptor)50 53
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0beta1 on Thu Jan 8 16:06:24 2009 | http://epydoc.sourceforge.net |