-
Notifications
You must be signed in to change notification settings - Fork 1
fix: namespace log timestamp configuration #403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
| import platform | ||
| import sys | ||
| import time | ||
| import warnings | ||
| from io import TextIOWrapper | ||
| from pathlib import Path | ||
| from typing import BinaryIO, TextIO, cast | ||
|
|
@@ -21,6 +22,7 @@ | |
|
|
||
| from ._private_files import restrict_file | ||
| from .context import get_current_context | ||
| from .deprecations import BaseCliDeprecationWarning | ||
| from .history import compact_home_text | ||
| from .json_contracts import JsonLogFormatter | ||
| from .paths import current_working_dir | ||
|
|
@@ -213,7 +215,22 @@ def _secure_log_file_open_flags(mode: str) -> int: | |
|
|
||
| class CliFormatter(logging.Formatter): | ||
| def __init__(self, *, use_utc: bool | None = None, use_color: bool = False) -> None: | ||
| self.use_utc = use_utc if use_utc is not None else os.environ.get("LOG_UTC") == "1" | ||
| if use_utc is not None: | ||
| resolved_use_utc = use_utc | ||
| else: | ||
| configured_use_utc = os.environ.get("BASE_CLI_LOG_UTC") | ||
| legacy_use_utc = os.environ.get("LOG_UTC") | ||
| if legacy_use_utc: | ||
| warnings.warn( | ||
| "LOG_UTC is deprecated since 0.5 and will be removed in 0.7; use BASE_CLI_LOG_UTC instead.", | ||
| BaseCliDeprecationWarning, | ||
| stacklevel=2, | ||
| ) | ||
| if configured_use_utc is not None: | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correctness (silent behavior): when both |
||
| resolved_use_utc = configured_use_utc == "1" | ||
| else: | ||
| resolved_use_utc = legacy_use_utc == "1" | ||
| self.use_utc = resolved_use_utc | ||
| self.use_color = use_color | ||
| datefmt = "%Y-%m-%d %H:%M:%S UTC" if self.use_utc else "%Y-%m-%d %H:%M:%S %z" | ||
| super().__init__(datefmt=datefmt) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Policy violation:
docs/api-stability.mdrequires every deprecation to "remain supported for at least two minor releases and 90 calendar days, whichever is longer." CurrentVERSIONis 0.4.3, so introducing the warning in 0.5 and scheduling removal in 0.6 is only one minor release apart — a user upgrading from 0.5.x straight to 0.6.0 losesLOG_UTCsupport without the two-minor-release window this project's own policy promises.