Browse Source

Changed discord.Client.event to debug log success instead of info log.

This is suggested to prevent spamming the console unnecesarilly.

Info should be used to output information to the user that is important, but
not a warning or an error. If I am bundling a bot as a modular package then
it doesn't really make sense to spam their console with every time a coroutine
is subscribed to, as it likely will not mean anything to the user. If they are
interested in this, it would make more sense to just to enable debugging first.

I have made this change, as I am writing a wrapper for this library for a
private project, and that will handle dispatching events, thus, I do not
need a prompt for each event that is subscribed to in this module outside of
DEBUG. Currently, with logging set to INFO, I am getting 47 lines reading:

    INFO:discord.client:coroutine has successfully been registered as an event

...being output as my bot starts, and without having to disable INFO logging
altogether, I am currently having to temporarily change the verbosity of the
logger as the events are initialised, which is not desirable as it could
potentially cover up any other INFO messages that would be useful to have
output.

Using a filter seems like a bit of a hacky workaround. If this isn't acceptable
then another alternative would be to add a parameter to the constructor of
discord.Client to enable or disable printing this information.
pull/798/head
espeonofespeonage 8 years ago
parent
commit
fd531297d2
  1. 2
      discord/client.py

2
discord/client.py

@ -773,7 +773,7 @@ class Client:
raise ClientException('event registered must be a coroutine function')
setattr(self, coro.__name__, coro)
log.info('%s has successfully been registered as an event', coro.__name__)
log.debug('%s has successfully been registered as an event', coro.__name__)
return coro
def async_event(self, coro):

Loading…
Cancel
Save