serena.util.logging#
Source code: serena/util/logging.py
- class LogMessages(messages: list[str], max_idx: int)[source]#
Bases:
object- Parameters:
messages (list[str])
max_idx (int)
- messages: list[str]#
the list of log messages, ordered from oldest to newest
- max_idx: int#
the 0-based index of the last message in messages (in the full log history)
- class MemoryLogHandler(level=0, max_messages=2500)[source]#
Bases:
HandlerInitializes the instance - basically setting the formatter to None and the filter list to empty.
- Parameters:
level (int)
max_messages (int | None)
- class LogBuffer(max_messages=None)[source]#
Bases:
objectA thread-safe buffer for storing (an optionally limited number of) log messages.
- Parameters:
max_messages (int | None)
- class SuspendedLoggersContext[source]#
Bases:
objectA context manager that provides an isolated logging environment.
Temporarily removes all root log handlers upon entry, providing a clean slate for defining new log handlers within the context. Upon exit, restores the original logging configuration. This is useful when you need to temporarily configure an isolated logging setup with well-defined log handlers.
- The context manager:
Removes all existing (root) log handlers on entry
Allows defining new temporary handlers within the context
Restores the original configuration (handlers and root log level) on exit
- Example:
>>> with SuspendedLoggersContext(): ... # No handlers are active here (configure your own and set desired log level) ... pass >>> # Original log handlers are restored here