Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def write(message, priority=Priority.INFO):
""" Write message into systemd journal
:type priority: Priority
:type message: str
"""
priority = int(Priority(int(priority)))
send(priority=priority, message=message)
class JournaldLogHandler(logging.Handler):
LEVELS = {
logging.CRITICAL: Priority.CRITICAL.value,
logging.FATAL: Priority.PANIC.value,
logging.ERROR: Priority.ERROR.value,
logging.WARNING: Priority.WARNING.value,
logging.WARN: Priority.WARNING.value,
logging.INFO: Priority.INFO.value,
logging.DEBUG: Priority.DEBUG.value,
logging.NOTSET: Priority.NONE.value,
}
__slots__ = ("__facility",)
def __init__(self, identifier=None, facility=Facility.DAEMON):
"""
:type identifier: Override default journald identifier
:type facility: Facility