Skip to content

Use more performant version of Python logging calls #1205

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 4 commits into from
Jul 26, 2023

Conversation

madscientist
Copy link
Contributor

No description provided.

@codecov-commenter
Copy link

Codecov Report

Patch coverage: 6.06% and no project coverage change.

Comparison is base (fb5f845) 34.83% compared to head (31310c4) 34.83%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1205   +/-   ##
=======================================
  Coverage   34.83%   34.83%           
=======================================
  Files          44       44           
  Lines        7949     7949           
  Branches     1072     1072           
=======================================
  Hits         2769     2769           
  Misses       5068     5068           
  Partials      112      112           
Files Changed Coverage Δ
atlassian/bitbucket/__init__.py 29.96% <0.00%> (ø)
atlassian/confluence.py 13.23% <0.00%> (ø)
atlassian/jira.py 19.92% <0.00%> (ø)
atlassian/rest_client.py 68.04% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gonchik
Copy link
Member

gonchik commented Jul 25, 2023

@madscientist what achievement we can get from that notation?

@madscientist
Copy link
Contributor Author

Basically, the logging string is not formatted until/unless the log message is going to be emitted. So for, for example, debug() messages which are rarely if ever actually emitted to a log sink, this means Python doesn't have to allocate the string and format it all. See for info https://docs.python.org/3/library/logging.html#logging.debug

If you use .format() then the formatted string is constructed by the calling function before the logger even gets to see it, so it cannot avoid the formatting even if the resulting formatted string is just dropped on the floor.

@gonchik gonchik merged commit 1a5a0a0 into atlassian-api:master Jul 26, 2023
@gonchik
Copy link
Member

gonchik commented Jul 26, 2023

Thanks for explanation :) @madscientist

@madscientist madscientist deleted the pds/logging branch July 27, 2023 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants