Пример #1
0
 def test_create_single_logger5(self):
     """
     Create a simple logger from detailed parameter input
     """
     try:
         PywbemLoggers.create_logger('http',
                                     'file',
                                     log_filename=None,
                                     log_detail_level='mi')
         self.fail('Exception expected')
     except ValueError as ve:
         if VERBOSE:
             print('ve %s' % ve)
Пример #2
0
    def test_create_single_logger4(self):
        """
        Create a simple logger from detailed parameter input
        """
        PywbemLoggers.create_logger('all',
                                    'stderr',
                                    log_filename=None,
                                    log_detail_level='min')

        if VERBOSE:
            print('pywbem_loggers dict %s' % PywbemLoggers.loggers)
        expected_result = \
            {'pywbem.http': ('min', 'stderr', None),
             'pywbem.ops': ('min', 'stderr', None)}

        self.assertEqual(PywbemLoggers.loggers, expected_result)
Пример #3
0
    def test_create_single_logger2(self):
        """
        Create a simple logger from detailed parameter input
        """
        PywbemLoggers.create_logger('http',
                                    'file',
                                    log_filename=TEST_OUTPUT_LOG,
                                    log_detail_level='min')

        if VERBOSE:
            print('pywbem_loggers dict %s' % PywbemLoggers.loggers)
        expected_result = \
            {'pywbem.http': ('min', 'file', TEST_OUTPUT_LOG)}

        self.assertEqual(
            PywbemLoggers.loggers, expected_result, 'Actual %s, Expected %s' %
            (PywbemLoggers.loggers, expected_result))
Пример #4
0
    def test_create_single_logger1(self):
        """
        Create a simple logger
        """
        PywbemLoggers.create_logger('ops',
                                    'file',
                                    log_filename=TEST_OUTPUT_LOG,
                                    log_detail_level='min')

        if VERBOSE:
            print('pywbem_loggers dict %s' % PywbemLoggers.loggers)
        expected_result = \
            {'pywbem.ops': ('min', 'file', TEST_OUTPUT_LOG)}

        # test getting from logger variable
        self.assertEqual(PywbemLoggers.loggers, expected_result)

        # test use of __repr__
        expected_result = 'PywbemLoggers(%s)' % expected_result
        self.assertEqual(('%r' % PywbemLoggers), expected_result)