-
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0d2bb4c
Expose logger functions at module level for backwards comp
jordanrfrazier 01c4cda
[autofix.ci] apply automated fixes
autofix-ci[bot] 03dcf86
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] 086aa35
[autofix.ci] apply automated fixes (attempt 3/3)
autofix-ci[bot] ca5a87d
Merge branch 'main' into fix-logger-import
jordanrfrazier 8a9c8ab
[autofix.ci] apply automated fixes
autofix-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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__ = [ | ||
| "acritical", | ||
| "adebug", | ||
| "aerror", | ||
| "aexception", | ||
| "ainfo", | ||
| "awarning", | ||
| "configure", | ||
| "critical", | ||
| "debug", | ||
| "error", | ||
| "exception", | ||
| "info", | ||
| "logger", | ||
| "warning", | ||
| ] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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