Skip to content

Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)

Python

patch: disable automatic variable dumps in file logs (#2047)

Ali Khokharb30981595bff
diff --git a/src/free_claude_code/config/logging_config.py b/src/free_claude_code/config/logging_config.py
index 6391fd38..130b177e 100644
--- a/src/free_claude_code/config/logging_config.py
+++ b/src/free_claude_code/config/logging_config.py
@@ -71,6 +71,7 @@ def _add_file_sink(log_file: str | Path, level: str) -> int:
log_path,
level=level,
serialize=True,
+ diagnose=False,
encoding="utf-8",
mode="a",
rotation="50 MB",
diff --git a/tests/config/test_logging_config.py b/tests/config/test_logging_config.py
index 8ae05efa..8619f10d 100644
--- a/tests/config/test_logging_config.py
+++ b/tests/config/test_logging_config.py
@@ -76,6 +76,31 @@ def test_native_json_preserves_exception_chain_and_stack(tmp_path, stdlib):
assert "test_native_json_preserves_exception_chain_and_stack" in row["text"]
[email protected]("stdlib", [False, True])
+def test_exception_logs_omit_local_values_but_keep_explicit_context(tmp_path, stdlib):
+ log_file = tmp_path / "exception.log"
+ configure_logging(log_file, force=True)
+ secret = "DUMMY_EXCEPTION_CREDENTIAL"
+ headers = {"Authorization": f"Bearer {secret}"}
+ try:
+ _ = len(headers) / 0
+ except ZeroDivisionError:
+ with logger.contextualize(attempt=2):
+ if stdlib:
+ logging.getLogger("test.exception").exception("request failed")
+ else:
+ logger.exception("request failed")
+ logger.complete()
+
+ text = log_file.read_text(encoding="utf-8")
+ assert secret not in text
+ row = json.loads(text)
+ assert row["record"]["extra"]["attempt"] == 2
+ assert row["record"]["message"] == "request failed"
+ assert row["record"]["exception"]["traceback"] is True
+ assert "ZeroDivisionError: division by zero" in row["text"]
+
+
def test_logging_preserves_records_across_process_restarts(tmp_path):
log_file = tmp_path / "server.log"
script = """