python-mattermost-driver icon indicating copy to clipboard operation
python-mattermost-driver copied to clipboard

errors are unconditionally logged to terminal

Open vmpjdc opened this issue 4 years ago • 2 comments

While writing some code against our Mattermost, I discovered that exceptions are being logged, even though my code is handling them. For example, ResourceNotFound wrote the following to my terminal:

Unable to find an existing account matching your username for this team. This team may require an invite from the team owner to join.

My script dealt with the situation, and so this logging is unwanted noise.

vmpjdc avatar Jul 02 '20 03:07 vmpjdc

Mhh, I get your point. What do you think would be a good solution for that? Would you be okay if you had an option like, dont log errors or rather a log anything at all?

I think, keeping the log.error active by default helps people to spot problems faster, so I would prefer an option to disable the output.

Vaelor avatar Jul 02 '20 09:07 Vaelor

One option, as a user of mattermostdriver, is to disable the logger by setting

logging.getLogger('mattermostdriver.websocket').disabled = True

On a related note, it would be good to have a common ancestor for all exceptions thrown.

thmo avatar Aug 28 '21 10:08 thmo