Python syslog.LOG_LOCAL4 Examples
The following are 3
code examples of syslog.LOG_LOCAL4().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
syslog
, or try the search function
.
Example #1
Source File: kindle_logging.py From librariansync with GNU General Public License v3.0 | 5 votes |
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)
Example #2
Source File: staticip.py From HPN-Scripting with MIT License | 5 votes |
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] ))
Example #3
Source File: test_output.py From daiquiri with Apache License 2.0 | 5 votes |
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"))