-
-
Notifications
You must be signed in to change notification settings - Fork 536
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
About Log Message Formatting on Reconnect #1501
Comments
My opinion is mainly "let's not get too fancy, or else someone is going to complain that it doesn't work in their APM / ..." |
I've never seen the pattern of removing the traceback in 18 years of building software in Python so I'm worried that it may have consequences that we would regret. |
Okay, so how about turning websockets/src/websockets/asyncio/client.py Lines 523 to 527 in 76f6f57
into self.logger.info(
"! connect failed; reconnecting in %.1f seconds",
delay,
)
self.logger.debug(exc, exc_info=True) # or similar With that, we would have a middle way: The traceback is still there if desired, but does not irritate the average user right away. As the traceback is also only useful for developers, the |
I looked into this over the weekend and I've grown sympathetic to your position. I started standardizing on "all DEBUG and ERROR logs have tracebacks; none of the INFO and WARNING logs do". Rationale:
|
The double log is an interesting idea. To be honest I was planning to keep it simple; if it crashes, just |
Ah, okay, so my enhancement request would be covered by this. I like 👍
Sorry, I am unsure what you mean by that. |
I meant "if I do simple INFO logging without traceback and a user wants the traceback, they can get the traceback by calling |
I took a quick stab at fixing it. I'm leaving it there for tonight; I'll review my own PR later :-) Meanwhile, happy to get your feedback. |
Hey Aymeric,
I noticed that by this line
websockets/src/websockets/asyncio/client.py
Line 525 in 98f236f
the full traceback of the current Exception is included in the log message, which looks confusing to me.
Example
Since this exception is indeed useful to get to know about failed connections or received responses, how do feel about just deleting the traceback and keeping the exception message with one of these options?
Removing Traceback
exc_info=(type(exc), exc, None)
(see Python Logging Docs andsys.exc_info()
)exc_info=exc.with_traceback(None)
(see Python Docs)Example
Put exception into logging message
Example
Personally, I prefer the last one.
The text was updated successfully, but these errors were encountered: