shakemap.utils.logging¶
- shakemap.utils.logging.get_logger(eventid, log_option=None, log_file=None)[source]¶
Return the logger instance for ShakeMap. Only use once!
- shakemap.utils.logging.get_logging_config()[source]¶
Extract logging configuration from logging.conf.
See this URL for example of config. https://gist.github.com/st4lk/6287746
See https://docs.python.org/3.5/library/logging.config.html
- Returns:
Dictionary suitable for use with logging.config.dictConfig().
- Return type:
- shakemap.utils.logging.get_generic_logger(logfile=None, fmt=None, datefmt=None, level=None)[source]¶
Returns a generic logging configuration dictionary that may be used by programs like receive_amps and receive_origins to create a logger. If the fmt and/or the datefmt are not specified, they will be taken from the config in the operator’s logging.conf. If logfile is not specified, the configuration will be for a stream handler. If level is not specified, it will be logging.INFO.
- Parameters:
logfile – The path to the file to receive the logging information. This will be a TimedRotatingFilehandler that will reset at midnight every night. If logfile is not specified, a StreamHandler will be configured.
fmt – The format string for the logging messages. If it is not supplied, the string from the current profile’s logging.conf will be used.
datefmt – The format string for the logging date/time. If it is not supplied, the string from the current profile’s logging.conf will be used.
level – The logging level. If not specified, it will be ‘INFO’. Other valid choices are ‘DEBUG’, ‘WARNING’, or ‘ERROR’.
- Returns:
A logger suitable for logging messages.
- Return type:
logger