OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import logging | 5 import logging |
6 import unittest | 6 import unittest |
7 | 7 |
8 from webkitpy.common.system.logtesting import LoggingTestCase, LogTesting, TestL
ogStream | 8 from webkitpy.common.system.log_testing import LoggingTestCase, LogTesting, Test
LogStream |
9 | 9 |
10 | 10 |
11 class TestLogStreamTest(unittest.TestCase): | 11 class TestLogStreamTest(unittest.TestCase): |
12 | 12 |
13 def test_passed_to_stream_handler(self): | 13 def test_passed_to_stream_handler(self): |
14 stream = TestLogStream(self) | 14 stream = TestLogStream(self) |
15 handler = logging.StreamHandler(stream) | 15 handler = logging.StreamHandler(stream) |
16 logger = logging.getLogger('test.logger') | 16 logger = logging.getLogger('test.logger') |
17 logger.addHandler(handler) | 17 logger.addHandler(handler) |
18 logger.setLevel(logging.INFO) | 18 logger.setLevel(logging.INFO) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 'INFO: Informative message\n', | 51 'INFO: Informative message\n', |
52 'WARNING: Warning message\n', | 52 'WARNING: Warning message\n', |
53 ]) | 53 ]) |
54 | 54 |
55 @staticmethod | 55 @staticmethod |
56 def example_logging_code(): | 56 def example_logging_code(): |
57 logger = logging.getLogger('test.logger') | 57 logger = logging.getLogger('test.logger') |
58 logger.debug('Debugging message') | 58 logger.debug('Debugging message') |
59 logger.info('Informative message') | 59 logger.info('Informative message') |
60 logger.warning('Warning message') | 60 logger.warning('Warning message') |
OLD | NEW |