def msg(self, *message, **kw): """ 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. Keyword arguments will be converted into items in the event dict that is passed to L{ILogObserver} implementations. Each implementation, in turn, can define keys that are used by it specifically, in addition to common keys listed at L{ILogObserver.__call__}. For example, to set the C{system} parameter while logging a message:: >>> log.msg('Started', system='Foo') """ actualEventDict = (context.get(ILogContext) or {}).copy() actualEventDict.update(kw) actualEventDict['message'] = message actualEventDict['time'] = time.time() _publishNew(self._publishPublisher, actualEventDict, textFromEventDict)
def emit(self, eventDict: EventDict) -> None: """ Receive a twisted log entry, format it and bridge it to python. By default the logging level used is info; log.err produces error level, and you can customize the level by using the C{logLevel} key:: >>> log.msg('debugging', logLevel=logging.DEBUG) """ if "log_format" in eventDict: _publishNew(self._newObserver, eventDict, textFromEventDict)
def emit(self, eventDict): """ Receive a twisted log entry, format it and bridge it to python. By default the logging level used is info; log.err produces error level, and you can customize the level by using the C{logLevel} key:: >>> log.msg('debugging', logLevel=logging.DEBUG) """ if 'log_format' in eventDict: _publishNew(self._newObserver, eventDict, textFromEventDict)
def msg(self, *message, **kw): """ 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. Keyword arguments will be converted into items in the event dict that is passed to L{ILogObserver} implementations. Each implementation, in turn, can define keys that are used by it specifically, in addition to common keys listed at L{ILogObserver.__call__}. For example, to set the C{system} parameter while logging a message:: >>> log.msg('Started', system='Foo') """ actualEventDict = (context.get(ILogContext) or {}).copy() actualEventDict.update(kw) actualEventDict['message'] = message actualEventDict['time'] = time.time() if "isError" not in actualEventDict: actualEventDict["isError"] = 0 _publishNew(self._publishPublisher, actualEventDict, textFromEventDict)