def test_json_null(capture: jsonlog.tests.capture.Capture): jsonlog.basicConfig() jsonlog.warning("No exc_info, traceback should be hidden") assert '"traceback": ' not in capture
import jsonlog jsonlog.warning("Hello world.")
def test_ensure_config(capture: jsonlog.tests.capture.Capture): jsonlog.warning("Hello world") assert '"message": "Hello world"' in capture
def test_basic_config(capture: jsonlog.tests.capture.Capture): jsonlog.basicConfig() jsonlog.warning("Hello world") assert '"message": "Hello world"' in capture
"""Tracebacks will be included in the output JSON.""" import jsonlog jsonlog.warning("Started script") try: raise ValueError("Example exception") except ValueError: jsonlog.exception("Encountered an error")
"""The jsonlog formatter is configured when you call module-level functions.""" import jsonlog jsonlog.warning("User %(user)s clicked a button", {"user": 123})