-
Notifications
You must be signed in to change notification settings - Fork 10k
fix(logging): hide default service field in pretty console #14909
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 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -209,6 +209,16 @@ def _get_service_info() -> dict[str, str]: | |||||||||||||||||
| return info | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| def _hide_default_service_for_pretty_console( | ||||||||||||||||||
| _logger: Any, | ||||||||||||||||||
| _method_name: str, | ||||||||||||||||||
| event_dict: dict[str, Any], | ||||||||||||||||||
| ) -> dict[str, Any]: | ||||||||||||||||||
| if event_dict.get("service") == "langflow": | ||||||||||||||||||
| event_dict.pop("service", None) | ||||||||||||||||||
| return event_dict | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| # Default keys whose values are redacted before rendering. Production logs leak | ||||||||||||||||||
| # auth tokens, cookies, and API keys with surprising regularity (third-party | ||||||||||||||||||
| # clients log request bodies, dict reprs, kwargs, etc.); a cheap, default-on | ||||||||||||||||||
|
|
@@ -1145,6 +1155,7 @@ def _append_json_tail() -> None: | |||||||||||||||||
| processors.append(structlog.processors.format_exc_info) | ||||||||||||||||||
| processors.append(structlog.processors.KeyValueRenderer()) | ||||||||||||||||||
| else: | ||||||||||||||||||
| processors.append(_hide_default_service_for_pretty_console) | ||||||||||||||||||
|
Contributor
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. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Apply the filter to every human-readable console branch. When Add the processor before the Suggested placement if log_stdout_pretty:
+ processors.append(_hide_default_service_for_pretty_console)
if log_format:
processors.append(structlog.processors.format_exc_info)
processors.append(structlog.processors.KeyValueRenderer())
else:
- processors.append(_hide_default_service_for_pretty_console)
processors.append(structlog.dev.ConsoleRenderer(colors=True))📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
| processors.append(structlog.dev.ConsoleRenderer(colors=True)) | ||||||||||||||||||
| else: | ||||||||||||||||||
| _append_json_tail() | ||||||||||||||||||
|
|
||||||||||||||||||
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.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Isolate the default-service test from environment variables.
Clear
LANGFLOW_SERVICE_NAMEandLANGFLOW_LOG_FORMATbeforeconfigure. A CI environment can set either variable. The test can then pass without exercising the defaultlangflowvalue or the defaultConsoleRendererpath.🤖 Prompt for AI Agents