Skip to content

Conversation

@jordanrfrazier
Copy link
Collaborator

@jordanrfrazier jordanrfrazier commented Nov 20, 2025

Exposes logger functions for backwards compat

Repro:

  • build flow in 1.6.x with agent component. Notice it uses pattern:
from langflow.logging import logger

logger.ainfo("..") 

Upload to main, try running. Get error: langflow.logging.logger has no attribute ainfo.

Summary by CodeRabbit

  • New Features
    • Enhanced logging module with streamlined access to common logging functions
    • Added async variants for non-blocking logging operations

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 20, 2025

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.

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

Walkthrough

Module-level logger method aliases added to src/backend/base/langflow/logging/logger.py, exposing synchronous methods (info, debug, warning, error, critical, exception) and their async counterparts (ainfo, adebug, awarning, aerror, acritical, aexception) at the module level. The __all__ export list is expanded to include all new aliases.

Changes

Cohort / File(s) Summary
Logger module aliases
src/backend/base/langflow/logging/logger.py
Added 12 module-level function aliases mapping to logger instance methods: synchronous (info, debug, warning, error, critical, exception) and asynchronous (ainfo, adebug, awarning, aerror, acritical, aexception). Updated __all__ to include all new aliases alongside existing "configure" and "logger" exports.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Straightforward additions of module-level aliases with no logic changes
  • Single file modification with consistent, repetitive pattern across all new exports
  • Simple all list expansion

Possibly related PRs

Suggested labels

bug, lgtm

Suggested reviewers

  • edwinjosechittilappilly
  • Cristhianzl

Pre-merge checks and finishing touches

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 warning)
Check name Status Explanation Resolution
Test Coverage For New Implementations ❌ Error PR adds 12 module-level logger aliases for backwards compatibility but no test files were added or modified to verify these new exports are functional and properly exposed. Add test file to verify the new module-level logger aliases (info, debug, warning, error, critical, exception, ainfo, aerror, adebug, awarning, acritical, aexception) are properly accessible and delegate correctly to underlying logger methods.
Test Quality And Coverage ⚠️ Warning PR adds 12 new module-level logger aliases but includes no test coverage for the new public API exports or their functionality. Add tests verifying all 12 aliases are correctly exposed, callable, and that async variants function as coroutines when awaited.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: exposing logger functions at module level for backwards compatibility, which directly matches the code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Test File Naming And Structure ✅ Passed PR modifies only logger.py for backwards compatibility; no test files are included in this PR, so test pattern compliance is not applicable.
Excessive Mock Usage Warning ✅ Passed PR modifies only logger.py to expose module-level functions; no test files are added, removed, or modified, making excessive mock usage review out of scope.

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 and usage tips.

@github-actions github-actions bot added the bug Something isn't working label Nov 20, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Nov 20, 2025
@github-actions github-actions bot added the lgtm This PR has been approved by a maintainer label Nov 20, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Nov 20, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3c5645d and 0d2bb4c.

📒 Files selected for processing (1)
  • src/backend/base/langflow/logging/logger.py (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: edwinjosechittilappilly
Repo: langflow-ai/langflow PR: 0
File: :0-0
Timestamp: 2025-08-07T20:23:23.569Z
Learning: Some Langflow starter project files and components still use `from loguru import logger` instead of the centralized structlog logger from `langflow.logging.logger`. These should be updated to ensure consistent structured logging across the entire codebase.
Learnt from: edwinjosechittilappilly
Repo: langflow-ai/langflow PR: 0
File: :0-0
Timestamp: 2025-08-07T20:23:23.569Z
Learning: The Langflow codebase uses structlog for structured logging with a centralized configuration in `src/backend/base/langflow/logging/logger.py`. The configuration supports multiple output formats (JSON, CSV, console) based on environment settings and properly implements global log level filtering.
Learnt from: edwinjosechittilappilly
Repo: langflow-ai/langflow PR: 0
File: :0-0
Timestamp: 2025-08-07T20:23:23.569Z
Learning: The Langflow codebase has an excellent structlog implementation that follows best practices, with proper global configuration, environment-based output formatting, and widespread adoption across components. The main cleanup needed is updating starter project templates and documentation examples that still contain legacy `from loguru import logger` imports.
📚 Learning: 2025-08-07T20:23:23.569Z
Learnt from: edwinjosechittilappilly
Repo: langflow-ai/langflow PR: 0
File: :0-0
Timestamp: 2025-08-07T20:23:23.569Z
Learning: Some Langflow starter project files and components still use `from loguru import logger` instead of the centralized structlog logger from `langflow.logging.logger`. These should be updated to ensure consistent structured logging across the entire codebase.

Applied to files:

  • src/backend/base/langflow/logging/logger.py
🪛 GitHub Actions: Ruff Style Check
src/backend/base/langflow/logging/logger.py

[error] 19-19: Ruff: RUF022 'all' is not sorted.

🪛 GitHub Check: Ruff Style Check (3.13)
src/backend/base/langflow/logging/logger.py

[failure] 19-34: Ruff (RUF022)
src/backend/base/langflow/logging/logger.py:19:11: RUF022 __all__ is not sorted

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
  • GitHub Check: Validate PR
  • GitHub Check: Run Backend Tests / Integration Tests - Python 3.10
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 3
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 5
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 2
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 4
  • GitHub Check: Run Backend Tests / LFX Tests - Python 3.10
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 1
  • GitHub Check: Test Starter Templates
  • GitHub Check: Optimize new Python code in this PR
  • GitHub Check: Update Starter Projects
  • GitHub Check: Update Component Index
  • GitHub Check: Run Ruff Check and Format
🔇 Additional comments (1)
src/backend/base/langflow/logging/logger.py (1)

11-17: The async logger methods are officially supported by structlog.

structlog provides async variants (ainfo(), adebug(), aerror(), etc.) — added in v23.1.0 — which run the regular logging call asynchronously. The module-level aliases in lines 11-17 are valid and properly expose structlog's built-in async methods. The codebase already uses these methods successfully throughout (as seen in src/lfx/src/lfx/utils/util.py and src/lfx/src/lfx/components/olivya/olivya.py).

Likely an incorrect or invalid review comment.

Comment on lines +3 to +9
# Expose logger methods at module level for backwards compatibility
info = logger.info
debug = logger.debug
warning = logger.warning
error = logger.error
critical = logger.critical
exception = logger.exception
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

Verify that the logger object supports all aliased methods.

The module-level aliases for synchronous logging methods look correct. However, since logger is imported from the external lfx.log.logger module, ensure that it exposes all the standard logging methods being aliased here.


🏁 Script executed:

#!/bin/bash
# Description: Verify logger object has the expected methods by checking lfx library usage

# Search for usage of logger.info, logger.debug, etc. to confirm these methods exist
rg -n --type=py -C2 'logger\.(info|debug|warning|error|critical|exception)\(' | head -30

Length of output: 2332




🏁 Script executed:

#!/bin/bash
# View the complete logging/logger.py file to see all aliases and __all__ list
cat src/backend/base/langflow/logging/logger.py

Length of output: 75



---

🏁 Script executed:

```shell
#!/bin/bash
# Search for logger.py files in the repository
fd -name "logger.py" -type f | head -20

Length of output: 230



---

🏁 Script executed:

```shell
#!/bin/bash
# Search for logger.py files
fd logger.py

Length of output: 145



---

🏁 Script executed:

```shell
#!/bin/bash
# View the target logger.py file
cat src/backend/base/langflow/logging/logger.py

Length of output: 680



---

🏁 Script executed:

```shell
#!/bin/bash
# View the lfx logger source to verify it has the async methods
cat src/lfx/src/lfx/log/logger.py

Length of output: 14237



---

🌐 Web query:

```web
structlog BoundLogger async methods support aerror ainfo

💡 Result:

Yes — structlog's BoundLogger provides async-prefixed methods (ainfo, aerror, adebug, awarning, alog, etc.). These were added in v23.1.0 (you can await log.ainfo(...)). The older AsyncBoundLogger wrapper exists but is deprecated in favor of the a-prefixed methods. [1][2]

Sources:

  • structlog API docs (async variants added, usage example). [1]
  • structlog.stdlib module docs (AsyncBoundLogger deprecation / details). [2]

Sort the __all__ list alphabetically to fix Ruff RUF022 violation.

The logger methods are correctly aliased—structlog's BoundLogger supports all requested sync methods (info, debug, warning, error, critical, exception) and async methods (ainfo, aerror, adebug, awarning, acritical, aexception) since v23.1.0. However, the __all__ list at lines 19-34 is not sorted alphabetically, causing the Ruff linter to fail. Reorder the list alphabetically: acritical, adebug, aerror, aexception, ainfo, awarning, configure, critical, debug, error, exception, info, logger, warning.

🤖 Prompt for AI Agents
In src/backend/base/langflow/logging/logger.py around lines 3-34, the __all__
export list is not alphabetized and triggers Ruff RUF022; reorder the entries in
the __all__ list to be alphabetically sorted as: acritical, adebug, aerror,
aexception, ainfo, awarning, configure, critical, debug, error, exception, info,
logger, warning so the linter passes.

Comment on lines 19 to 34
__all__ = [
"configure",
"logger",
"info",
"debug",
"warning",
"error",
"critical",
"exception",
"aerror",
"ainfo",
"adebug",
"awarning",
"acritical",
"aexception",
]
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix the __all__ list sorting to resolve pipeline failure.

The __all__ list is not sorted alphabetically, causing the Ruff RUF022 check to fail. This is blocking the pipeline.

Apply this diff to sort the list:

 __all__ = [
+    "acritical",
+    "adebug",
+    "aerror",
+    "aexception",
+    "ainfo",
+    "awarning",
     "configure",
-    "logger",
-    "info",
+    "critical",
     "debug",
-    "warning",
     "error",
-    "critical",
+    "exception",
+    "info",
+    "logger",
-    "exception",
-    "aerror",
-    "ainfo",
-    "adebug",
-    "awarning",
-    "acritical",
-    "aexception",
+    "warning",
 ]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
__all__ = [
"configure",
"logger",
"info",
"debug",
"warning",
"error",
"critical",
"exception",
"aerror",
"ainfo",
"adebug",
"awarning",
"acritical",
"aexception",
]
__all__ = [
"acritical",
"adebug",
"aerror",
"aexception",
"ainfo",
"awarning",
"configure",
"critical",
"debug",
"error",
"exception",
"info",
"logger",
"warning",
]
🧰 Tools
🪛 GitHub Actions: Ruff Style Check

[error] 19-19: Ruff: RUF022 'all' is not sorted.

🪛 GitHub Check: Ruff Style Check (3.13)

[failure] 19-34: Ruff (RUF022)
src/backend/base/langflow/logging/logger.py:19:11: RUF022 __all__ is not sorted

🤖 Prompt for AI Agents
In src/backend/base/langflow/logging/logger.py around lines 19 to 34, the
__all__ list is not alphabetically sorted which triggers Ruff RUF022; reorder
the entries in the __all__ list into strict alphabetical order (e.g., acritical,
adebug, aexception, ainfo, aerror, awarning, configure, critical, debug,
exception, error, info, logger, warning) preserving the same string names and
list formatting so the linter passes.

@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Nov 20, 2025
@github-actions
Copy link
Contributor

Frontend Unit Test Coverage Report

Coverage Summary

Lines Statements Branches Functions
Coverage: 15%
14.68% (3985/27139) 7.56% (1560/20608) 8.94% (535/5984)

Unit Test Results

Tests Skipped Failures Errors Time
1630 0 💤 0 ❌ 0 🔥 18.594s ⏱️

@codecov
Copy link

codecov bot commented Nov 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 31.65%. Comparing base (6f6c9a7) to head (8a9c8ab).
⚠️ Report is 1 commits behind head on main.

❌ Your project status has failed because the head coverage (38.96%) is below the target coverage (60.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #10670      +/-   ##
==========================================
- Coverage   31.66%   31.65%   -0.01%     
==========================================
  Files        1350     1350              
  Lines       61163    61175      +12     
  Branches     9142     9142              
==========================================
- Hits        19368    19366       -2     
- Misses      40879    40892      +13     
- Partials      916      917       +1     
Flag Coverage Δ
backend 51.86% <100.00%> (-0.05%) ⬇️
lfx 38.96% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/backend/base/langflow/logging/logger.py 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jordanrfrazier jordanrfrazier added lgtm This PR has been approved by a maintainer and removed lgtm This PR has been approved by a maintainer labels Nov 21, 2025
@Adam-Aghili
Copy link
Collaborator

Component Index merge conflict

@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Nov 24, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Nov 24, 2025
@jordanrfrazier jordanrfrazier added this pull request to the merge queue Nov 24, 2025
Merged via the queue into main with commit 9a2e2db Nov 24, 2025
80 of 81 checks passed
@jordanrfrazier jordanrfrazier deleted the fix-logger-import branch November 24, 2025 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants