EventHandler (autotransform.event.handler)¶
The EventHandler receives event dispatches and triggers appropriate behavior for the event, such as logging. Set AUTO_TRANSFORM_EVENT_HANDLER environment variable to {
class_name: <The name of a class extending EventHandler>, module: <The fully qualified module where the class is>
} as JSON to override the default event handling.
- class autotransform.event.handler.EventHandler¶
Bases:
object
The handler that all Events are dispatched to that logs these events.
- _logging_level¶
The level for which logs will be output to CLI.
- Type:
- __instance¶
The singleton instance of the EventHandler.
- Type:
Optional[EventHandler]
- __color_map¶
A mapping from log level to ANSI color for CLI output.
- Type:
Dict[LoggingLevel, str]
- static get() EventHandler ¶
Singleton method for getting the event handler.
- Returns:
The singleton instance of the EventHandler.
- Return type:
- handle(event: Event) None ¶
Handles the given Event, logging and executing any hooks needed.
- Parameters:
event (Event) – The Event that was triggered.
- static output_to_cli(event: Event) None ¶
Outputs the event to CLI with appropriate coloring.
- Parameters:
event (Event) – The event being logged.
- set_logging_level(logging_level: LoggingLevel) None ¶
Sets the level of logs to include in console outputs.
- Parameters:
logging_level (LoggingLevel) – The logging level to output to console.