我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用syslog.LOG_DAEMON。
def __init__(self): syslog.openlog(facility=syslog.LOG_DAEMON)
def __init__(self, name, facility=syslog.LOG_DAEMON): logging.Handler.__init__(self) syslog.openlog(name, syslog.LOG_PID, facility)
def start_syslog(name='python-app', facility=syslog.LOG_DAEMON, capture_stdout=IfNotInteractive, capture_stderr=IfNotInteractive): if syslog is Null: raise RuntimeError("syslog is not available on this platform") for handler in root_logger.handlers[:]: root_logger.removeHandler(handler) handler = SyslogHandler(name, facility) handler.setFormatter(_default_formatter) root_logger.addHandler(handler) if capture_stdout: sys.stdout = StandardIOLogger(root_logger.info) if capture_stderr: sys.stderr = StandardIOLogger(root_logger.error)
def log(msg, cap=0): global DEBUG_LEVEL if DEBUG_LEVEL >= cap: syslog.syslog(syslog.LOG_NOTICE|syslog.LOG_DAEMON, msg)