ogstools.logparser.log_file_handler module#
- class ogstools.logparser.log_file_handler.LogFileHandler[source]#
Bases:
FileSystemEventHandlerParse the lines that OGS appends to a log file and put the records into a queue.
- Parameters:
file_name (
str|Path) – The location of the log file to monitor.queue (
Queue) – The queue where log entries are put and to be consumed.status (
Context) – The status of the simulation (e.g. current time step).stop_callback (
Callable[[],None]) – A callback function to stop the simulation.line_limit (
int) – The number of lines to read before stopping the simulation. 0 means no limit.
- __init__(file_name, queue, status, stop_callback, line_limit=0)[source]#
- Parameters:
file_name (
str|Path) – The location of the log file to monitor.queue (
Queue) – The queue where log entries are put and to be consumed.status (
Context) – The status of the simulation (e.g. current time step).stop_callback (
Callable[[],None]) – A callback function to stop the simulation.line_limit (
int) – The number of lines to read before stopping the simulation. 0 means no limit.
- on_created(event)[source]#
Process the log file when it is created.
- Parameters:
event (
DirCreatedEvent|FileCreatedEvent) – The file system event from watchdog.- Return type: