-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
callsite parameter fix while operating under asyncio
#565
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Sample: import asyncio
import structlog
structlog.configure(
processors=[
structlog.processors.CallsiteParameterAdder(
{
structlog.processors.CallsiteParameter.FILENAME,
structlog.processors.CallsiteParameter.FUNC_NAME,
structlog.processors.CallsiteParameter.LINENO,
},
),
structlog.processors.JSONRenderer(),
],
context_class=dict,
cache_logger_on_first_use=True,
)
logger = structlog.get_logger()
def sync_logging():
logger.info("hello sync")
async def async_logging():
await logger.ainfo("hello async via ainfo")
if __name__ == "__main__":
sync_logging()
loop = asyncio.get_event_loop()
loop.run_until_complete(async_logging())
loop.close() Produces:
|
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.
Thanks this is cool! needs some work, but should be straight-forward.
How’s recent commit looking? |
Hm I tried to push changes into your branch but I'm getting a permission denied. Are you sure you haven't forgotten to grant the permission for that or am I just failing at git here? |
hm no if the checkmark is set, it should work. maybe it's because you opened your PR from your own main branch which has protections. You should avoid doing that in general, none-the-least because once this PR is merged, you'll have a bad time syncing your fork due to squash and merge. sadly that's an information that comes too late for the PR checklist ;) |
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.
Thanks!
Summary
Added support for proper callsite parameters while operating under
asyncio
Pull Request Check List
api.py
.New functions/classes have to be added to
docs/api.rst
by hand.Changed/added classes/methods/functions have appropriate
versionadded
,versionchanged
, ordeprecated
directives.The next version is the second number in the current release + 1. The first number represents the current year. So if the current version on PyPI is 23.1.0, the next version is gonna be 23.2.0. If the next version is the first in the new year, it'll be 24.1.0.
.rst
and.md
files is written using semantic newlines.