diff options
author | shmel1k <shmel1k@ydb.tech> | 2023-11-26 18:16:14 +0300 |
---|---|---|
committer | shmel1k <shmel1k@ydb.tech> | 2023-11-26 18:43:30 +0300 |
commit | b8cf9e88f4c5c64d9406af533d8948deb050d695 (patch) | |
tree | 218eb61fb3c3b96ec08b4d8cdfef383104a87d63 /contrib/python/Twisted/py3/twisted/logger/_interfaces.py | |
parent | 523f645a83a0ec97a0332dbc3863bb354c92a328 (diff) | |
download | ydb-b8cf9e88f4c5c64d9406af533d8948deb050d695.tar.gz |
add kikimr_configure
Diffstat (limited to 'contrib/python/Twisted/py3/twisted/logger/_interfaces.py')
-rw-r--r-- | contrib/python/Twisted/py3/twisted/logger/_interfaces.py | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/contrib/python/Twisted/py3/twisted/logger/_interfaces.py b/contrib/python/Twisted/py3/twisted/logger/_interfaces.py new file mode 100644 index 0000000000..496de1de54 --- /dev/null +++ b/contrib/python/Twisted/py3/twisted/logger/_interfaces.py @@ -0,0 +1,63 @@ +# Copyright (c) Twisted Matrix Laboratories. +# See LICENSE for details. + +""" +Logger interfaces. +""" + +from typing import TYPE_CHECKING, Any, Dict, List, Tuple + +from zope.interface import Interface + +if TYPE_CHECKING: + from ._logger import Logger + + +LogEvent = Dict[str, Any] +LogTrace = List[Tuple["Logger", "ILogObserver"]] + + +class ILogObserver(Interface): + """ + An observer which can handle log events. + + Unlike most interfaces within Twisted, an L{ILogObserver} I{must be + thread-safe}. Log observers may be called indiscriminately from many + different threads, as any thread may wish to log a message at any time. + """ + + def __call__(event: LogEvent) -> None: + """ + Log an event. + + @param event: A dictionary with arbitrary keys as defined by the + application emitting logging events, as well as keys added by the + logging system. The logging system reserves the right to set any + key beginning with the prefix C{"log_"}; applications should not + use any key so named. Currently, the following keys are used by + the logging system in some way, if they are present (they are all + optional): + + - C{"log_format"}: a PEP-3101-style format string which draws + upon the keys in the event as its values, used to format the + event for human consumption. + + - C{"log_flattened"}: a dictionary mapping keys derived from + the names and format values used in the C{"log_format"} + string to their values. This is used to preserve some + structured information for use with + L{twisted.logger.extractField}. + + - C{"log_trace"}: A L{list} designed to capture information + about which L{LogPublisher}s have observed the event. + + - C{"log_level"}: a L{log level + <twisted.logger.LogLevel>} constant, indicating the + importance of and audience for this event. + + - C{"log_namespace"}: a namespace for the emitter of the event, + given as a L{str}. + + - C{"log_system"}: a string indicating the network event or + method call which resulted in the message being logged. + """ |