Skip to content

example_revert

Workflow revert execution example

MemoryLogHandler

Bases: Handler

Source code in client/ayon_workflow/demo/example_revert.py
22
23
24
25
26
27
28
29
30
31
32
class MemoryLogHandler(logging.Handler):
    def __init__(self):
        super().__init__()
        self.records = []

    def emit(self, record):
        self.records.append(self.format(record))

    def filter_lines(self, pattern: str) -> list[str]:
        """Return logs that match the pattern regex."""
        return [line for line in self.records if pattern in line]

filter_lines(pattern)

Return logs that match the pattern regex.

Source code in client/ayon_workflow/demo/example_revert.py
30
31
32
def filter_lines(self, pattern: str) -> list[str]:
    """Return logs that match the pattern regex."""
    return [line for line in self.records if pattern in line]