Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" This module provides standardized logging for whole sentinel network.
There are 2 preconfigured handlers: - syslog - INFO and higher severity - file under rotation - DEBUG and higher severity
Expected usage in your script:
``` import logging import sn logger = logging.getLogger("component_name") logger.info("I'm running!") ```
Your logger will inherit INFO level from root logger. This is kind a fail-safe mechanism. If you need to use DEBUG level, you must enable it explicitly:
``` import logging import sn logger = logging.getLogger("component_name") logger.setLevel(logging.DEBUG) logger.debug("Still running...") ```
Please, do not change logging format for syslog handler. It will be parsed by TM. File handler is prefixed by current time, for better debugging.
"""
"%Y-%m-%d %H:%M:%S") "%Y-%m-%d %H:%M:%S")
if issubclass(exc_type, KeyboardInterrupt): sys.__excepthook__(exc_type, exc_value, exc_traceback) return
root_logger.exception("Uncaught exception", exc_info=(exc_type, exc_value, exc_traceback)) sys.__excepthook__(exc_type, exc_value, exc_traceback)
|