本文整理汇总了Python中syslog.LOG_ALERT属性的典型用法代码示例。如果您正苦于以下问题:Python syslog.LOG_ALERT属性的具体用法?Python syslog.LOG_ALERT怎么用?Python syslog.LOG_ALERT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类syslog
的用法示例。
在下文中一共展示了syslog.LOG_ALERT属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_emitErrorPriority
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ALERT [as 别名]
def test_emitErrorPriority(self):
"""
L{SyslogObserver.emit} uses C{LOG_ALERT} if the event represents an
error.
"""
self.observer.emit({
'message': ('hello, world',), 'isError': True, 'system': '-',
'failure': Failure(Exception("foo"))})
self.assertEqual(
self.events,
[(stdsyslog.LOG_ALERT, '[-] hello, world')])
示例2: alert
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ALERT [as 别名]
def alert(msg):
syslog.syslog(syslog.LOG_ALERT, _encode(msg))
示例3: loglevel_alert
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ALERT [as 别名]
def loglevel_alert():
loglevel(syslog.LOG_ALERT)
# common logging patterns
示例4: log
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ALERT [as 别名]
def log(self, message, log_level=syslog.LOG_ALERT):
"""Log to the syslog, and if verbose, also to stdout."""
syslog.syslog(log_level, message)
if self.verbose:
print message
示例5: vlog
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ALERT [as 别名]
def vlog(cls, message, log_level=syslog.LOG_ALERT):
"""Log to the syslog and to stdout."""
syslog.syslog(log_level, message)
print message
示例6: _logMail
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ALERT [as 别名]
def _logMail(self, individualReceiver):
if self.rulesMatched == "None": #Remove the "None" used to differentiate between no result and result with No rules matched to save space in log file.
self.rulesMatched = ""
self.endTime = time.time()
timeDiff = int((self.endTime - self.startTime)*100000) # Convert to Microsec
timeDiffZMQ = int((self.endTimeZMQ - self.startTimeZMQ)*100000) # Convert to Microsec
log = "%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s"%(self._logMail_sanitize(self.archiveFileName),
self._logMail_sanitize(self.messageID),
self._logMail_sanitize(self.milterConfig.milterInstance),
self._logMail_sanitize(self.rulesMatched),
self._logMail_sanitize(self.dispositions),
self._logMail_sanitize(self.attachments),
self._logMail_sanitize(self.sender),
self._logMail_sanitize(self._getClientAddr()),
self._logMail_sanitize(individualReceiver),
self._logMail_sanitize(self._getIfAddr()),
self._logMail_sanitize(self.messageDate),
#self._logMail_sanitize(timeDiff),
self._logMail_sanitize(self.milterConfig._unconvertDispositionMode(self.rtnToMTA)),
self._logMail_sanitize(self.qid),
self._logMail_sanitize(""), #TODO: scanner IP?
self._logMail_sanitize(timeDiffZMQ),
self._logMail_sanitize(self.subject))
self.logger.writeLog(syslog.LOG_ALERT, "%s"%(str(log)))
示例7: syslogout
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ALERT [as 别名]
def syslogout(msg, logLevel=syslog.LOG_DEBUG, logFacility=syslog.LOG_USER):
# Output to the syslog.
arg0 = os.path.basename(sys.argv[0])
host = socket.gethostname()
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
f = "%(asctime)s " + host + \
" %(module)s(%(process)d): %(levelname)s: %(message)s"
formatter = logging.Formatter(fmt=f, datefmt='%b %d %H:%M:%S')
fh = logging.FileHandler(
filename='/var/log/masakari/masakari-instancemonitor.log')
fh.setLevel(logging.DEBUG)
fh.setFormatter(formatter)
logger.addHandler(fh)
if logLevel == syslog.LOG_DEBUG:
logger.debug(msg)
elif logLevel == syslog.LOG_INFO or logLevel == syslog.LOG_NOTICE:
logger.info(msg)
elif logLevel == syslog.LOG_WARNING:
logger.warn(msg)
elif logLevel == syslog.LOG_ERR:
logger.error(msg)
elif logLevel == syslog.LOG_CRIT or \
logLevel == syslog.LOG_ALERT or \
logLevel == syslog.LOG_EMERGE:
logger.critical(msg)
else:
logger.debug(msg)
logger.removeHandler(fh)
#################################
# Function name:
# virEventFilter
#
# Function overview:
# Filter events from libvirt.
#
# Argument:
# eventID : EventID
# eventType : Event type
# detail : Event name
# uuID : UUID
#
# Return value:
# None
#
#################################