Skip to content
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

don't call format inside logger calls. #1

Closed
crwilcox opened this issue Aug 16, 2017 · 1 comment
Closed

don't call format inside logger calls. #1

crwilcox opened this issue Aug 16, 2017 · 1 comment

Comments

@crwilcox
Copy link
Collaborator

crwilcox commented Aug 16, 2017

It is bad practice to call str.format() in a logger call because it's a waste of compute if the logger ever gets set so that debug calls are ignored. …

What you can do is in your logging.Formatter() call above is specify you want to use str.format()-style formatting. Then here you could do:
logger.debug("current max size {} is {}", path, max_size)

@crwilcox
Copy link
Collaborator Author

Also, logger.warning('error writing ' + str(e)) could use an exception-logging call which would log the traceback

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

No branches or pull requests

1 participant