Logs

Set up some system-wide loggers

The logs Module

Set up some system-wide loggers

class openquake.engine.logs.LogFileHandler(job, log_file)[source]

Bases: logging.FileHandler

Log file handler

emit(record)[source]
class openquake.engine.logs.LogStreamHandler(job)[source]

Bases: logging.StreamHandler

Log stream handler

emit(record)[source]
openquake.engine.logs.handle(*args, **kwds)[source]

Context manager adding and removing log handlers.

Parameters:
  • job – a openquake.engine.db.models.OqJob instance
  • log_level – one of debug, info, warn, progress, error, critical
  • log_file – log file path (if None, logs on stdout only)
openquake.engine.logs.set_level(level)[source]

Initialize logs to write records with level level or above.

class openquake.engine.logs.tracing(msg)[source]

Bases: object

Simple context manager util to handle tracing. E.g.

with log(“exports”):
do_export()