Skip to content
Merged
Changes from 5 commits
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__ = [
"acritical",
"adebug",
"aerror",
"aexception",
"ainfo",
"awarning",
"configure",
"critical",
"debug",
"error",
"exception",
"info",
"logger",
"warning",
]
Loading