本文整理汇总了Python中syslog.LOG_LOCAL4属性的典型用法代码示例。如果您正苦于以下问题:Python syslog.LOG_LOCAL4属性的具体用法?Python syslog.LOG_LOCAL4怎么用?Python syslog.LOG_LOCAL4使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类syslog
的用法示例。
在下文中一共展示了syslog.LOG_LOCAL4属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: log
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_LOCAL4 [as 别名]
def log(program, function, msg, level="I", display=True):
global LAST_SHOWN
# open syslog
syslog.openlog("system: %s %s:%s:" % (level, program, function))
# set priority
priority = syslog.LOG_INFO
if level == "E":
priority = syslog.LOG_ERR
elif level == "W":
priority = syslog.LOG_WARNING
priority |= syslog.LOG_LOCAL4
# write to syslog
syslog.syslog(priority, msg)
#
# NOTE: showlog / showlog -f to check the logs
#
if display:
program_display = " %s: " % program
displayed = " "
# If loglevel is anything else than I, add it to our tag
if level != "I":
displayed += "[%s] " % level
displayed += utf8_str(msg)
# print using FBInk (via cFFI)
fbink.fbink_print(fbink.FBFD_AUTO, "%s\n%s" % (program_display, displayed), FBINK_CFG)
示例2: main
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_LOCAL4 [as 别名]
def main():
config = get_config_port_ip()
list_live_ip(config)
for i in config.keys():
if arp(i) == config[i]:
continue
if arp(i) == 'none':
syslog.openlog( 'WARNING', 0, syslog.LOG_LOCAL7 )
syslog.syslog(syslog.LOG_ALERT, '%s %s IS NOT ACTIVE ' % (socket.gethostname(), i))
else:
syslog.openlog( 'WARNING', 0, syslog.LOG_LOCAL4 )
syslog.syslog(syslog.LOG_ALERT, '%s %s IS IN WRONG PORT %s AND SHOULD BE IN %s ' % (socket.gethostname(), i, arp(i),config[i] ))
示例3: test_find_facility
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_LOCAL4 [as 别名]
def test_find_facility(self):
self.assertEqual(syslog.LOG_USER,
output.Syslog._find_facility("user"))
self.assertEqual(syslog.LOG_LOCAL1,
output.Syslog._find_facility("log_local1"))
self.assertEqual(syslog.LOG_LOCAL2,
output.Syslog._find_facility("LOG_local2"))
self.assertEqual(syslog.LOG_LOCAL3,
output.Syslog._find_facility("LOG_LOCAL3"))
self.assertEqual(syslog.LOG_LOCAL4,
output.Syslog._find_facility("LOCaL4"))