Skip to content

fix(logs): hide default service field in dev console - #13624

Open
luochen211 wants to merge 10 commits into
langflow-ai:release-1.11.0from
luochen211:fix-console-log-service-field
Open

fix(logs): hide default service field in dev console#13624
luochen211 wants to merge 10 commits into
langflow-ai:release-1.11.0from
luochen211:fix-console-log-service-field

Conversation

@luochen211

@luochen211 luochen211 commented Jun 11, 2026

Copy link
Copy Markdown

Fixes #13615.

Summary

  • hide the default service=langflow field from human-oriented pretty console logs
  • keep service metadata in container/JSON logs for structured observability
  • add regression coverage for --dev pretty console output

Tests

  • uv run pytest src/backend/tests/unit/test_logger.py -q
  • uv run ruff check src/lfx/src/lfx/log/logger.py src/backend/tests/unit/test_logger.py
  • uv run ruff format --check src/lfx/src/lfx/log/logger.py src/backend/tests/unit/test_logger.py
  • git diff --check

Summary by CodeRabbit

  • Tests

    • Added test case to verify that console logging output in development environment with pretty-print formatting correctly filters and hides the default service field identifier from logs.
  • Bug Fixes

    • Improved readability of console logs by implementing logic to strip default service metadata from all pretty-printed log output in development mode.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: dfadd544-f861-48bc-a6c9-587f4ed093f3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This PR introduces a structlog processor that removes the repetitive service=langflow field from human-oriented console logs. The processor is added to the pretty console renderer pipeline in development mode and is validated by a new unit test that confirms log messages appear without the default service metadata.

Changes

Service field filtering in pretty console logs

Layer / File(s) Summary
Service field filtering processor and validation
src/lfx/src/lfx/log/logger.py, src/backend/tests/unit/test_logger.py
A new structlog processor _hide_default_service_for_pretty_console removes the service field from log events when it equals the default value "langflow". The processor is wired into the pretty stdout rendering path in configure(). Test imports (importlib, re) and a new TestProductionObservability.test_dev_pretty_console_hides_default_service_field() method validate that log messages are rendered without the default service metadata in dev/pretty mode.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 9
✅ Passed checks (9 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: hiding the default service field in dev console logs to reduce noise in pretty console output.
Linked Issues check ✅ Passed The code changes directly address issue #13615 by implementing a processor that removes the default service=langflow field from pretty console logs while preserving it in structured/JSON logs.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the repeating service field issue: a processor to hide the field in pretty console mode and a test to verify the behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Test Coverage For New Implementations ✅ Passed PR includes a regression test test_dev_pretty_console_hides_default_service_field that properly validates the new _hide_default_service_for_pretty_console processor, verifying the fix for bug #...
Test Quality And Coverage ✅ Passed Test adequately covers main functionality: validates processor registration in pretty console mode and confirms default "langflow" service field is hidden via capsys output capture and ANSI strippi...
Test File Naming And Structure ✅ Passed Test file follows correct patterns: proper naming (test_*.py), logical pytest class organization, descriptive test names, comprehensive setup/teardown methods, proper fixture usage, edge cases, and...
Excessive Mock Usage Warning ✅ Passed Test uses appropriate fixtures (capsys, monkeypatch) for environment setup and output verification, not excessive mocks. Tests real logging system behavior with actual objects, following integratio...

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the bug Something isn't working label Jun 11, 2026
@luochen211
luochen211 force-pushed the fix-console-log-service-field branch from 27a16c8 to c3c61de Compare June 11, 2026 09:52
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 11, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/backend/tests/unit/test_logger.py (1)

798-811: ⚡ Quick win

Test name suggests DEV-specific behavior, but the service hiding is not DEV-dependent.

The test name test_dev_pretty_console_hides_default_service_field and the explicit DEV=True patch (line 801) suggest that hiding the service field is DEV-mode specific. However, looking at the logger implementation (line 611), the _hide_default_service_for_pretty_console processor is added regardless of the DEV flag value. The DEV flag only controls callsite parameter addition (lines 520-529).

Consider either:

  1. Renaming the test to test_pretty_console_hides_default_service_field (removing "dev")
  2. Removing the DEV=True patch if it's not required for the behavior under test

Also consider adding test coverage for the LANGFLOW_LOG_FORMAT=key_value case to verify the service field behavior with KeyValueRenderer.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/backend/tests/unit/test_logger.py` around lines 798 - 811, The test name
and monkeypatch are misleading because the
_hide_default_service_for_pretty_console processor is registered by configure(),
not gated by DEV; update the test accordingly by either renaming
test_dev_pretty_console_hides_default_service_field to
test_pretty_console_hides_default_service_field and removing the
monkeypatch.setattr(logger_module, "DEV", True) call, or keep the name but drop
the DEV patch so the test only asserts the behavior of configure()/
_hide_default_service_for_pretty_console; optionally add a second test that sets
LANGFLOW_LOG_FORMAT="key_value" and asserts the service field behavior when
using the KeyValueRenderer to cover that code path as well.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/backend/tests/unit/test_logger.py`:
- Around line 798-811: The test name and monkeypatch are misleading because the
_hide_default_service_for_pretty_console processor is registered by configure(),
not gated by DEV; update the test accordingly by either renaming
test_dev_pretty_console_hides_default_service_field to
test_pretty_console_hides_default_service_field and removing the
monkeypatch.setattr(logger_module, "DEV", True) call, or keep the name but drop
the DEV patch so the test only asserts the behavior of configure()/
_hide_default_service_for_pretty_console; optionally add a second test that sets
LANGFLOW_LOG_FORMAT="key_value" and asserts the service field behavior when
using the KeyValueRenderer to cover that code path as well.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b266181b-a4b5-479d-bcfa-febe5c74d06e

📥 Commits

Reviewing files that changed from the base of the PR and between 29140c0 and c3c61de.

📒 Files selected for processing (2)
  • src/backend/tests/unit/test_logger.py
  • src/lfx/src/lfx/log/logger.py

@luochen211
luochen211 force-pushed the fix-console-log-service-field branch from c3c61de to 71099a9 Compare June 11, 2026 10:18
@luochen211

luochen211 commented Jun 11, 2026

Copy link
Copy Markdown
Author

Addressed the CodeRabbit nitpick: the pretty-console service-field test no longer implies DEV-specific behavior, and the unused DEV patch/import were removed. Re-verified with uv run pytest src/backend/tests/unit/test_logger.py -q, ruff check/format, and git diff --check.

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 11, 2026
@luochen211

Copy link
Copy Markdown
Author

CI looks blocked by runner/network setup rather than this PR change: both failed backend jobs stopped in astral-sh/setup-uv@v6 while resolving the latest uv release, ending with Github API request failed while getting latest release / Connect Timeout Error. A failed-job rerun should be enough, but I do not have repository admin permission to rerun the upstream workflow.

@erichare
erichare deleted the branch langflow-ai:release-1.11.0 July 1, 2026 18:33
@erichare erichare closed this Jul 1, 2026
@erichare erichare reopened this Jul 1, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 2, 2026
@erichare
erichare deleted the branch langflow-ai:release-1.11.0 July 15, 2026 18:36
@erichare erichare closed this Jul 15, 2026
@erichare erichare reopened this Jul 15, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 16, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 16, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 16, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 16, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 16, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 16, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants