t.p.l.LogPublisher : class documentation

Part of twisted.python.log View Source View In Hierarchy

Class for singleton log message publishing.
Method __init__ Undocumented
Method addObserver Add a new observer.
Method removeObserver Remove an observer.
Method msg Log a new message.
Method showwarning Twisted-enabled wrapper around warnings.showwarning.
Method _err Log a failure.
def __init__(self): (source)
Undocumented
def addObserver(self, other): (source)
Add a new observer.
ParametersotherA callable object that will be called with each new log message (a dict). (type: Provider of ILogObserver)
def removeObserver(self, other): (source)
Remove an observer.
def msg(self, *message, **kw): (source)
Log a new message.

For example:


>>> log.msg('Hello, world.')

In particular, you MUST avoid the forms:


>>> log.msg(u'Hello, world.')
>>> log.msg('Hello ', 'world.')

These forms work (sometimes) by accident and will be disabled entirely in the future.

def _err(self, failure, why): (source)
Log a failure.

Similar in functionality to the global {err} function, but the failure gets published only to observers attached to this publisher.

ParametersfailureThe failure to log. (type: Failure.)
whyThe source of this failure. This will be logged along with the failure and should describe the context in which the failure occurred. (type: str)
def showwarning(self, message, category, filename, lineno, file=None, line=None): (source)
Twisted-enabled wrapper around warnings.showwarning.

If file is None, the default behaviour is to emit the warning to the log system, otherwise the original warnings.showwarning Python function is called.

API Documentation for Twisted, generated by pydoctor at 2012-06-04 17:20:01.