Esempio n. 1
0
 def test_logger_bad_type(self):
     self.assertEqual('123 should be a string',
                      b10logging.check({'loggers':
                                       [{'name': 123,
                                         'severity': 'INFO'}]}))
     self.assertEqual('123 should be a string',
                      b10logging.check({'loggers':
                                       [{'name': 'bind10',
                                         'severity': 123}]}))
Esempio n. 2
0
 def test_logger_conf(self):
     self.assertEqual(None,
                      b10logging.check({'loggers':
                                       [{'name': '*',
                                         'severity': 'DEBUG',
                                         'debuglevel': 50,
                                         'output_options':
                                         [{'destination': 'file',
                                           'output': '/some/file'
                                         }]
                                        },
                                        {'name': 'b10-resolver',
                                         'severity': 'WARN',
                                         'additive': True,
                                         'output_options':
                                         [{'destination': 'console',
                                           'output': 'stderr',
                                           'flush': True
                                         }]
                                        },
                                        {'name': 'b10-resolver.resolver',
                                         'severity': 'ERROR',
                                         'output_options': []
                                        },
                                        {'name': '*.cache',
                                         'severity': 'INFO'
                                        }
                                       ]}))
Esempio n. 3
0
 def test_logger_bad_destination(self):
     self.assertEqual('bad destination for logger *: baddest',
                      b10logging.check({'loggers':
                                       [{'name': '*',
                                         'severity': 'INFO',
                                         'output_options': [
                                         { 'destination': 'baddest' }
                                         ]}]}))
Esempio n. 4
0
 def test_logger_bad_syslog_output(self):
     self.assertEqual('destination set to syslog but output not set to any facility for logger *',
                      b10logging.check({'loggers':
                                       [{'name': '*',
                                         'severity': 'INFO',
                                         'output_options': [
                                         { 'destination': 'syslog' }
                                         ]}]}))
Esempio n. 5
0
 def test_logger_bad_file_output(self):
     self.assertEqual('destination set to file but output not set to any filename for logger *',
                      b10logging.check({'loggers':
                                       [{'name': '*',
                                         'severity': 'INFO',
                                         'output_options': [
                                         { 'destination': 'file' }
                                         ]}]}))
Esempio n. 6
0
 def do_bad_name_test(self, name):
     err_str = "Bad logger name: '" + name + "': * can only be "\
               "used instead of the full first-level name, e.g. "\
               "'*' or '*.subsystem'"
     self.assertEqual(err_str,
                      b10logging.check({'loggers':
                                       [{'name': name,
                                         'severity': 'DEBUG'},
                                       ]}))
Esempio n. 7
0
 def test_logger_bad_console_output(self):
     self.assertEqual('bad output for logger *: bad_output, must be stdout or stderr',
                      b10logging.check({'loggers':
                                       [{'name': '*',
                                         'severity': 'INFO',
                                         'output_options': [
                                         { 'destination': 'console',
                                           'output': 'bad_output'
                                         }
                                         ]}]}))
Esempio n. 8
0
 def test_logger_bad_severity(self):
     self.assertEqual('bad severity value for logger *: BADVAL',
                      b10logging.check({'loggers':
                                       [{'name': '*',
                                         'severity': 'BADVAL'}]}))