-
Notifications
You must be signed in to change notification settings - Fork 8.2k
fix: expose logger functions at module level for backwards comp #10670
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
Changes from 1 commit
0d2bb4c
01c4cda
03dcf86
086aa35
ca5a87d
8a9c8ab
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # 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", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
19
to
34
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. Fix the The 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
Suggested change
🧰 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) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
🧩 Analysis chain
Verify that the logger object supports all aliased methods.
The module-level aliases for synchronous logging methods look correct. However, since
loggeris imported from the externallfx.log.loggermodule, ensure that it exposes all the standard logging methods being aliased here.🏁 Script executed:
Length of output: 2332
🏁 Script executed:
Length of output: 75
Length of output: 230
Length of output: 145
Length of output: 680
Length of output: 14237
💡 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:
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