Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion src/backend/base/langflow/logging/logger.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
from lfx.log.logger import configure, logger

__all__ = ["configure", "logger"]
# 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
Comment on lines +3 to +9
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.


# Expose async logger methods at module level
aerror = logger.aerror
ainfo = logger.ainfo
adebug = logger.adebug
awarning = logger.awarning
acritical = logger.acritical
aexception = logger.aexception

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

Check failure on line 34 in src/backend/base/langflow/logging/logger.py

View workflow job for this annotation

GitHub Actions / Ruff Style Check (3.13)

Ruff (RUF022)

src/backend/base/langflow/logging/logger.py:19:11: RUF022 `__all__` is not sorted
Comment on lines 19 to 34
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.

Loading