Enabling LoggingΒΆ

Telethon makes use of the logging module, and you can enable it as follows:

import logging
logging.basicConfig(level=logging.DEBUG)

The library has the NullHandler added by default so that no log calls will be printed unless you explicitly enable it.

You can also use the module on your own project very easily:

import logging
logger = logging.getLogger(__name__)

logger.debug('Debug messages')
logger.info('Useful information')
logger.warning('This is a warning!')

If you want to enable logging for your project but use a different log level for the library:

import logging
logging.basicConfig(level=logging.DEBUG)
# For instance, show only warnings and above
logging.getLogger('telethon').setLevel(level=logging.WARNING)