mapchete.log module

Custom loggers for external code such as user processes & drivers.

This is necessary because if using the logging module directly, the namespace is not assigned properly and log levels & log handlers cannot be assigned correctly.

class mapchete.log.KeyValueFilter(key_value_replace=None)

Bases: Filter

This filter looks for dictionaries passed on to log messages and replaces its values with a replacement if key matches the pattern.

Examples

>>> stream_handler.addFilter(
...     KeyValueFilter(
...         key_value_replace={
...             "AWS_ACCESS_KEY_ID": "***",
...             "AWS_SECRET_ACCESS_KEY": "***",
...         }
...     )
... )
filter(record)

Determine if the specified record is to be logged.

Returns True if the record should be logged, or False otherwise. If deemed appropriate, the record may be modified in-place.

redact(msg)
mapchete.log.add_module_logger(module_name)
mapchete.log.driver_logger(dname)

Logger to be used from a driver plugin.

mapchete.log.set_log_level(loglevel)
mapchete.log.setup_logfile(logfile)
mapchete.log.user_process_logger(pname)

Logger to be used within a user process file.