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)
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.

The message should be a native string, i.e. bytes on Python 2 and Unicode on Python 3. For compatibility with both use the native string syntax, for example:

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

You MUST avoid passing in Unicode on Python 2, and the form:

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

This form only works (sometimes) by accident.

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 2013-11-18 18:11:01.