kukosk / pyapns_client

Simple, flexible and fast Apple Push Notifications on iOS, OSX and Safari using the HTTP/2 Push provider API.
Other
25 stars 11 forks source link

Avoid premature formatting in logger calls #8

Closed salty-horse closed 2 years ago

salty-horse commented 2 years ago

This commit reworks the logging changes in 899c46ddaf4e98cdecf507849fef86a7ac1b7a5e. I'm fine with rejecting it if you really don't like this approach.

According to best practices, calls to the logger function should not perform their own formatting. In most cases, especially with these debug calls, the logging action will not be performed, so the extra work to format the string in advance is wasted.

kukosk commented 2 years ago

I agree with you @salty-horse that it adds a tiny bit of overhead, but I also think it's negligible in this case and using f-strings just makes it so much easier to read that I ended up using this approach. I'm going to close this PR, but thank you very much for the suggestion, I really appreciate it! 😊