__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Test cases for L{twisted.logger._capture}.
"""
from twisted.logger import Logger, LogLevel
from twisted.trial.unittest import TestCase
from .._capture import capturedLogs
class LogCaptureTests(TestCase):
"""
Tests for L{LogCaptureTests}.
"""
log = Logger()
def test_capture(self) -> None:
"""
Events logged within context are captured.
"""
foo = object()
with capturedLogs() as captured:
self.log.debug("Capture this, please", foo=foo)
self.log.info("Capture this too, please", foo=foo)
self.assertTrue(len(captured) == 2)
self.assertEqual(captured[0]["log_format"], "Capture this, please")
self.assertEqual(captured[0]["log_level"], LogLevel.debug)
self.assertEqual(captured[0]["foo"], foo)
self.assertEqual(captured[1]["log_format"], "Capture this too, please")
self.assertEqual(captured[1]["log_level"], LogLevel.info)
self.assertEqual(captured[1]["foo"], foo)
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| __init__.py | File | 161 B | 0644 |
|
| test_buffer.py | File | 1.78 KB | 0644 |
|
| test_capture.py | File | 1.06 KB | 0644 |
|
| test_file.py | File | 5.7 KB | 0644 |
|
| test_filter.py | File | 12.96 KB | 0644 |
|
| test_flatten.py | File | 9.42 KB | 0644 |
|
| test_format.py | File | 22.37 KB | 0644 |
|
| test_global.py | File | 12.47 KB | 0644 |
|
| test_io.py | File | 8.65 KB | 0644 |
|
| test_json.py | File | 17.85 KB | 0644 |
|
| test_legacy.py | File | 14.26 KB | 0644 |
|
| test_levels.py | File | 867 B | 0644 |
|
| test_logger.py | File | 8.01 KB | 0644 |
|
| test_observer.py | File | 6.04 KB | 0644 |
|
| test_stdlib.py | File | 8.53 KB | 0644 |
|
| test_util.py | File | 3.69 KB | 0644 |
|