Module t.p.log

Part of twisted.python View Source

Logging and metrics infrastructure.
Line # Kind Name Docs
21 Class ILogContext Actually, this interface is just a synoym for the dictionary interface,
33 Function callWithContext Undocumented
38 Function callWithLogger Utility method which wraps a function in a try:/except:, logs a failure if
57 Function showwarning Undocumented
71 Function startKeepingErrors DEPRECATED in Twisted 2.5.
86 Function flushErrors DEPRECATED in Twisted 2.5. See TestCase.flushLoggedErrors.
120 Function ignoreErrors DEPRECATED
135 Function clearIgnores DEPRECATED
151 Function err Write a failure to the log.
197 Class Logger This represents a class which may 'own' a log. Used by subclassing.
210 Class LogPublisher Class for singleton log message publishing.
307 Function textFromEventDict Extract text from an event dict passed to a log observer. If it cannot
340 Class FileLogObserver Log observer that writes to a file-like object.
419 Class PythonLoggingObserver Output twisted messages to Python standard library logging module.
470 Class StdioOnnaStick Class that pretends to be stout/err.
519 Function startLogging Initialize logging to a specified file.
526 Function startLoggingWithObserver Initialize logging to a specified observer. If setStdout is true
546 Class NullFile Undocumented
554 Function discardLogs Throw away all logs.
570 Class DefaultObserver Default observer.
103 Function _flushErrors PRIVATE. DEPRECATED. DON'T USE.
128 Function _ignore PRIVATE. DEPRECATED. DON'T USE.
143 Function _clearIgnores PRIVATE. DEPRECATED. DON'T USE.
281 Function _safeFormat Try to format the string fmtString using fmtDict arguments,
def callWithContext(ctx, func, *args, **kw): (source)
Undocumented
def callWithLogger(logger, func, *args, **kw): (source)
Utility method which wraps a function in a try:/except:, logs a failure if one occurrs, and uses the system's logPrefix.
def showwarning(message, category, filename, lineno, file=None, line=None): (source)
Undocumented
def startKeepingErrors(): (source)

DEPRECATED in Twisted 2.5.

Support function for testing frameworks.

Start keeping errors in a buffer which can be retrieved (and emptied) with flushErrors.
def flushErrors(*errorTypes): (source)

DEPRECATED in Twisted 2.5. See TestCase.flushLoggedErrors.

Support function for testing frameworks.

Return a list of errors that occurred since the last call to flushErrors(). (This will return None unless startKeepingErrors has been called.)
def _flushErrors(*errorTypes): (source)
PRIVATE. DEPRECATED. DON'T USE.
def ignoreErrors(*types): (source)
DEPRECATED
def _ignore(*types): (source)
PRIVATE. DEPRECATED. DON'T USE.
def clearIgnores(): (source)
DEPRECATED
def _clearIgnores(): (source)
PRIVATE. DEPRECATED. DON'T USE.
def err(_stuff=None, _why=None, **kw): (source)

Write a failure to the log.

The _stuff and _why parameters use an underscore prefix to lessen the chance of colliding with a keyword argument the application wishes to pass. It is intended that they be supplied with arguments passed positionally, not by keyword.
Parameters_stuffThe failure to log. If _stuff is None a new Failure will be created from the current exception state. If _stuff is an Exception instance it will be wrapped in a Failure. (type: NoneType, Exception, or Failure. )
_whyThe source of this failure. This will be logged along with _stuff and should describe the context in which the failure occurred. (type: str )
def _safeFormat(fmtString, fmtDict): (source)
Try to format the string fmtString using fmtDict arguments, swallowing all errors to always return a string.
def textFromEventDict(eventDict): (source)

Extract text from an event dict passed to a log observer. If it cannot handle the dict, it returns None.

The possible keys of eventDict are:
  • message: by default, it holds the final text. It's required, but can be empty if either isError or format is provided (the first having the priority).
  • isError: boolean indicating the nature of the event.
  • failure: failure.Failure instance, required if the event is an error.
  • why: if defined, used as header of the traceback in case of errors.
  • format: string format used in place of message to customize the event. It uses all keys present in eventDict to format the text.
Other keys will be used when applying the format, or ignored.
def startLogging(file, *a, **kw): (source)
Initialize logging to a specified file.
def startLoggingWithObserver(observer, setStdout=1): (source)
Initialize logging to a specified observer. If setStdout is true (defaults to yes), also redirect sys.stdout and sys.stderr to the specified file.
def discardLogs(): (source)
Throw away all logs.
API Documentation for Twisted, generated by pydoctor at 2008-10-26 16:12:37.