Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_interfaces.py 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # Copyright (c) Twisted Matrix Laboratories.
  2. # See LICENSE for details.
  3. """
  4. Logger interfaces.
  5. """
  6. from typing import TYPE_CHECKING, Any, Dict, List, Tuple
  7. from zope.interface import Interface
  8. if TYPE_CHECKING:
  9. from ._logger import Logger
  10. LogEvent = Dict[str, Any]
  11. LogTrace = List[Tuple["Logger", "ILogObserver"]]
  12. class ILogObserver(Interface):
  13. """
  14. An observer which can handle log events.
  15. Unlike most interfaces within Twisted, an L{ILogObserver} I{must be
  16. thread-safe}. Log observers may be called indiscriminately from many
  17. different threads, as any thread may wish to log a message at any time.
  18. """
  19. def __call__(event: LogEvent) -> None:
  20. """
  21. Log an event.
  22. @param event: A dictionary with arbitrary keys as defined by the
  23. application emitting logging events, as well as keys added by the
  24. logging system. The logging system reserves the right to set any
  25. key beginning with the prefix C{"log_"}; applications should not
  26. use any key so named. Currently, the following keys are used by
  27. the logging system in some way, if they are present (they are all
  28. optional):
  29. - C{"log_format"}: a PEP-3101-style format string which draws
  30. upon the keys in the event as its values, used to format the
  31. event for human consumption.
  32. - C{"log_flattened"}: a dictionary mapping keys derived from
  33. the names and format values used in the C{"log_format"}
  34. string to their values. This is used to preserve some
  35. structured information for use with
  36. L{twisted.logger.extractField}.
  37. - C{"log_trace"}: A L{list} designed to capture information
  38. about which L{LogPublisher}s have observed the event.
  39. - C{"log_level"}: a L{log level
  40. <twisted.logger.LogLevel>} constant, indicating the
  41. importance of and audience for this event.
  42. - C{"log_namespace"}: a namespace for the emitter of the event,
  43. given as a L{str}.
  44. - C{"log_system"}: a string indicating the network event or
  45. method call which resulted in the message being logged.
  46. """