Python syslog.LOG_INFO Examples
The following are 30
code examples of syslog.LOG_INFO().
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: NotifySyslog.py From bazarr with GNU General Public License v3.0 | 6 votes |
def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs): """ Perform Syslog Notification """ _pmap = { NotifyType.INFO: syslog.LOG_INFO, NotifyType.SUCCESS: syslog.LOG_NOTICE, NotifyType.FAILURE: syslog.LOG_CRIT, NotifyType.WARNING: syslog.LOG_WARNING, } # Always call throttle before any remote server i/o is made self.throttle() try: syslog.syslog(_pmap[notify_type], body) except KeyError: # An invalid notification type was specified self.logger.warning( 'An invalid notification type ' '({}) was specified.'.format(notify_type)) return False return True
Example #2
Source File: NotifySyslog.py From apprise with MIT License | 6 votes |
def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs): """ Perform Syslog Notification """ _pmap = { NotifyType.INFO: syslog.LOG_INFO, NotifyType.SUCCESS: syslog.LOG_NOTICE, NotifyType.FAILURE: syslog.LOG_CRIT, NotifyType.WARNING: syslog.LOG_WARNING, } # Always call throttle before any remote server i/o is made self.throttle() try: syslog.syslog(_pmap[notify_type], body) except KeyError: # An invalid notification type was specified self.logger.warning( 'An invalid notification type ' '({}) was specified.'.format(notify_type)) return False return True
Example #3
Source File: test_syslog.py From learn_python3_spider with MIT License | 5 votes |
def test_emitStripsTrailingEmptyLines(self): """ Trailing empty lines of a multiline message are omitted from the messages sent to the syslog. """ self.observer.emit({ 'message': ('hello,\nworld\n\n',), 'isError': False, 'system': '-'}) self.assertEqual( self.events, [(stdsyslog.LOG_INFO, '[-] hello,'), (stdsyslog.LOG_INFO, '[-] \tworld')])
Example #4
Source File: belchertown.py From weewx-belchertown with GNU General Public License v3.0 | 5 votes |
def loginf(msg): logmsg(syslog.LOG_INFO, msg)
Example #5
Source File: log.py From localslackirc with GNU General Public License v3.0 | 5 votes |
def log(*args) -> None: """ Logs to stdout or to syslog depending on if running with a terminal attached. """ if tty: print(*args) return syslog(LOG_INFO, ' '.join(str(i) for i in args))
Example #6
Source File: test_syslog.py From python-for-android with Apache License 2.0 | 5 votes |
def test_emitStripsTrailingEmptyLines(self): """ Trailing empty lines of a multiline message are omitted from the messages sent to the syslog. """ self.observer.emit({ 'message': ('hello,\nworld\n\n',), 'isError': False, 'system': '-'}) self.assertEqual( self.events, [(stdsyslog.LOG_INFO, '[-] hello,'), (stdsyslog.LOG_INFO, '[-] \tworld')])
Example #7
Source File: test_syslog.py From python-for-android with Apache License 2.0 | 5 votes |
def test_emitMultilineMessage(self): """ Each line of a multiline message is emitted separately to the syslog. """ self.observer.emit({ 'message': ('hello,\nworld',), 'isError': False, 'system': '-'}) self.assertEqual( self.events, [(stdsyslog.LOG_INFO, '[-] hello,'), (stdsyslog.LOG_INFO, '[-] \tworld')])
Example #8
Source File: test_syslog.py From python-for-android with Apache License 2.0 | 5 votes |
def test_emitMessage(self): """ L{SyslogObserver.emit} logs the value of the C{'message'} key of the event dictionary it is passed to the syslog. """ self.observer.emit({ 'message': ('hello, world',), 'isError': False, 'system': '-'}) self.assertEqual( self.events, [(stdsyslog.LOG_INFO, "[-] hello, world")])
Example #9
Source File: test_syslog.py From python-for-android with Apache License 2.0 | 5 votes |
def test_emitCustomSystem(self): """ L{SyslogObserver.emit} uses the value of the C{'system'} key to prefix the logged message. """ self.observer.emit({'message': ('hello, world',), 'isError': False, 'system': 'nonDefaultSystem'}) self.assertEqual( self.events, [(stdsyslog.LOG_INFO, "[nonDefaultSystem] hello, world")])
Example #10
Source File: test_syslog.py From python-for-android with Apache License 2.0 | 5 votes |
def test_emitCustomFacility(self): """ L{SyslogObserver.emit} uses the value of the C{'syslogPriority'} as the syslog priority, if that key is present in the event dictionary. """ self.observer.emit({ 'message': ('hello, world',), 'isError': False, 'system': '-', 'syslogFacility': stdsyslog.LOG_CRON}) self.assertEqual( self.events, [(stdsyslog.LOG_INFO | stdsyslog.LOG_CRON, '[-] hello, world')])
Example #11
Source File: graylog_api.py From bonfire with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, message_dict={}): self.message_dict = dict(message_dict["message"]) self.timestamp = arrow.get(self.message_dict.get("timestamp", None)) self.level = self.message_dict.get("level", syslog.LOG_INFO) self.message = self.message_dict.get("message", "")
Example #12
Source File: test_log.py From oslo.log with Apache License 2.0 | 5 votes |
def test_syslog(self): msg_unicode = u"Benoît Knecht & François Deppierraz login failure" handler = handlers.OSSysLogHandler() syslog.syslog = mock.Mock() handler.emit( logging.LogRecord("name", logging.INFO, "path", 123, msg_unicode, None, None)) syslog.syslog.assert_called_once_with(syslog.LOG_INFO, msg_unicode)
Example #13
Source File: test_formats.py From glog-cli with Apache License 2.0 | 5 votes |
def test_get_log_level_code(self): self.assertEquals(syslog.LOG_CRIT, LogLevel.find_by_level_name('CRITICAL')) self.assertEquals(syslog.LOG_WARNING, LogLevel.find_by_level_name('WARNING')) self.assertEquals(syslog.LOG_DEBUG, LogLevel.find_by_level_name('DEBUG')) self.assertEquals(syslog.LOG_INFO, LogLevel.find_by_level_name('INFO')) self.assertEquals(syslog.LOG_ERR, LogLevel.find_by_level_name('ERROR')) self.assertEquals(syslog.LOG_NOTICE, LogLevel.find_by_level_name('NOTICE')) self.assertIsNone(LogLevel.find_by_level_name('UNKNOWN'))
Example #14
Source File: test_formats.py From glog-cli with Apache License 2.0 | 5 votes |
def test_get_log_level_from_code(self): self.assertEquals('CRITICAL', LogLevel.find_by_syslog_code(syslog.LOG_CRIT)['name']) self.assertEquals('WARNING', LogLevel.find_by_syslog_code(syslog.LOG_WARNING)['name']) self.assertEquals('DEBUG', LogLevel.find_by_syslog_code(syslog.LOG_DEBUG)['name']) self.assertEquals('INFO', LogLevel.find_by_syslog_code(syslog.LOG_INFO)['name']) self.assertEquals('ERROR', LogLevel.find_by_syslog_code(syslog.LOG_ERR)['name']) self.assertEquals('NOTICE', LogLevel.find_by_syslog_code(syslog.LOG_NOTICE)['name']) self.assertEquals('', LogLevel.find_by_syslog_code(9999)['name'])
Example #15
Source File: test_formats.py From glog-cli with Apache License 2.0 | 5 votes |
def test_format_colored_with_level_info(self): self.message.level = syslog.LOG_INFO log = TailFormatter('({source}) - {message}', color=True).format(self.message) self.assertEquals(colored('(dummy.source) - dummy message', 'green'), log)
Example #16
Source File: graylog_api.py From glog-cli with Apache License 2.0 | 5 votes |
def __init__(self, message_dict={}): self.message_dict = dict(message_dict[utils.MESSAGE]) self.timestamp = arrow.get(self.message_dict.get("timestamp", None)) self.level = self.message_dict.get("level", syslog.LOG_INFO) self.message = self.message_dict.get(utils.MESSAGE, "")
Example #17
Source File: run_containers.py From container-agent with Apache License 2.0 | 5 votes |
def LogInfo(msg): syslog.syslog(syslog.LOG_LOCAL3 | syslog.LOG_INFO, msg)
Example #18
Source File: test_syslog.py From learn_python3_spider with MIT License | 5 votes |
def test_emitMultilineMessage(self): """ Each line of a multiline message is emitted separately to the syslog. """ self.observer.emit({ 'message': ('hello,\nworld',), 'isError': False, 'system': '-'}) self.assertEqual( self.events, [(stdsyslog.LOG_INFO, '[-] hello,'), (stdsyslog.LOG_INFO, '[-] \tworld')])
Example #19
Source File: test_syslog.py From learn_python3_spider with MIT License | 5 votes |
def test_emitMessage(self): """ L{SyslogObserver.emit} logs the value of the C{'message'} key of the event dictionary it is passed to the syslog. """ self.observer.emit({ 'message': ('hello, world',), 'isError': False, 'system': '-'}) self.assertEqual( self.events, [(stdsyslog.LOG_INFO, "[-] hello, world")])
Example #20
Source File: test_syslog.py From learn_python3_spider with MIT License | 5 votes |
def test_emitCustomSystem(self): """ L{SyslogObserver.emit} uses the value of the C{'system'} key to prefix the logged message. """ self.observer.emit({'message': ('hello, world',), 'isError': False, 'system': 'nonDefaultSystem'}) self.assertEqual( self.events, [(stdsyslog.LOG_INFO, "[nonDefaultSystem] hello, world")])
Example #21
Source File: test_syslog.py From learn_python3_spider with MIT License | 5 votes |
def test_emitCustomFacility(self): """ L{SyslogObserver.emit} uses the value of the C{'syslogPriority'} as the syslog priority, if that key is present in the event dictionary. """ self.observer.emit({ 'message': ('hello, world',), 'isError': False, 'system': '-', 'syslogFacility': stdsyslog.LOG_CRON}) self.assertEqual( self.events, [(stdsyslog.LOG_INFO | stdsyslog.LOG_CRON, '[-] hello, world')])
Example #22
Source File: alertlib_test.py From alertlib with MIT License | 5 votes |
def test_unknown_severity(self): alertlib.Alert('test message', severity=-4).send_to_logs() self.assertEqual([(syslog.LOG_INFO, 'test message')], self.sent_to_syslog)
Example #23
Source File: logging.py From pycopia with Apache License 2.0 | 5 votes |
def loglevel_info(): loglevel(syslog.LOG_INFO)
Example #24
Source File: logging.py From pycopia with Apache License 2.0 | 5 votes |
def info(msg): syslog.syslog(syslog.LOG_INFO, _encode(msg))
Example #25
Source File: test_syslog.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def test_emitStripsTrailingEmptyLines(self): """ Trailing empty lines of a multiline message are omitted from the messages sent to the syslog. """ self.observer.emit({ 'message': ('hello,\nworld\n\n',), 'isError': False, 'system': '-'}) self.assertEqual( self.events, [(stdsyslog.LOG_INFO, '[-] hello,'), (stdsyslog.LOG_INFO, '[-] \tworld')])
Example #26
Source File: test_syslog.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def test_emitMultilineMessage(self): """ Each line of a multiline message is emitted separately to the syslog. """ self.observer.emit({ 'message': ('hello,\nworld',), 'isError': False, 'system': '-'}) self.assertEqual( self.events, [(stdsyslog.LOG_INFO, '[-] hello,'), (stdsyslog.LOG_INFO, '[-] \tworld')])
Example #27
Source File: test_syslog.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def test_emitMessage(self): """ L{SyslogObserver.emit} logs the value of the C{'message'} key of the event dictionary it is passed to the syslog. """ self.observer.emit({ 'message': ('hello, world',), 'isError': False, 'system': '-'}) self.assertEqual( self.events, [(stdsyslog.LOG_INFO, "[-] hello, world")])
Example #28
Source File: test_syslog.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def test_emitCustomSystem(self): """ L{SyslogObserver.emit} uses the value of the C{'system'} key to prefix the logged message. """ self.observer.emit({'message': ('hello, world',), 'isError': False, 'system': 'nonDefaultSystem'}) self.assertEqual( self.events, [(stdsyslog.LOG_INFO, "[nonDefaultSystem] hello, world")])
Example #29
Source File: test_syslog.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def test_emitCustomFacility(self): """ L{SyslogObserver.emit} uses the value of the C{'syslogPriority'} as the syslog priority, if that key is present in the event dictionary. """ self.observer.emit({ 'message': ('hello, world',), 'isError': False, 'system': '-', 'syslogFacility': stdsyslog.LOG_CRON}) self.assertEqual( self.events, [(stdsyslog.LOG_INFO | stdsyslog.LOG_CRON, '[-] hello, world')])
Example #30
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)