本文整理匯總了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
#
#################################