load_account UserWarning should have stacklevel=2
See original GitHub issueWhen load_account
is ran twice, a warning is triggered:
The last line in the message, is a bit confusing because looks like an incomplete duplication. I suggest to use warnings.warn('Credentials are already in use. The existing account in the session will be replaced.', stacklevel=2)
, so the error would look like this:
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes that would be great thanks!
@ajavadia the use of
warning
has been essentially carried over from the times whereload_account
was introduced - at that point in time, it was deemed preferable to use awarning
instead oflogger.warning
on the grounds that it would be “more visible to users”; and it sort of stuck as the usual philosophy for the provider for similar messages and context.Personally I also feel more comfortable with a plain
logger.warning
and placing a bit more trust on the users being slightly more familiar with the logging facilities - does your comment count as having your green light for adopting that approach? 🤞