chore: lock runtime log output paths and ignore local logs

This commit is contained in:
qzl
2026-02-25 10:32:19 +08:00
parent 1dcfbbe33f
commit d16e66807d
4 changed files with 165 additions and 3 deletions
+6 -2
View File
@@ -24,12 +24,16 @@ def test_runtime_settings_defaults() -> None:
def test_runtime_settings_env_override(monkeypatch: MonkeyPatch) -> None:
monkeypatch.setenv("SOCIAL_RUNTIME__LOG_DIR", "var/logs")
monkeypatch.setenv("SOCIAL_RUNTIME__LOG_ERROR_DIR", "var/logs/errors")
monkeypatch.setenv("SOCIAL_RUNTIME__LOG_FILE_NAME", "custom.log")
monkeypatch.setenv("SOCIAL_RUNTIME__LOG_ERROR_FILE_NAME", "custom-error.log")
monkeypatch.setenv("SOCIAL_RUNTIME__LOG_ROTATION", "size")
monkeypatch.setenv("SOCIAL_RUNTIME__LOG_ROTATION_MAX_BYTES", "2048")
settings = Settings()
assert settings.runtime.log_dir == "var/logs"
assert settings.runtime.log_error_dir == "var/logs/errors"
assert settings.runtime.log_dir == "logs"
assert settings.runtime.log_error_dir == "logs/errors"
assert settings.runtime.log_file_name == "app.log"
assert settings.runtime.log_error_file_name == "error.log"
assert settings.runtime.log_rotation == "size"
assert settings.runtime.log_rotation_max_bytes == 2048