import logging

# Configure a basic 'securesystemslib' top-level logger with a StreamHandler
# (print to console) and the WARNING log level (print messages of type
# warning, error or critical). This is similar to what 'logging.basicConfig'
# would do with the root logger. All 'securesystemslib.*' loggers default to
# this top-level logger and thus may be configured (e.g. formatted, silenced,
# etc.) with it. It can be accessed via logging.getLogger('securesystemslib').
logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)
logger.addHandler(logging.StreamHandler())

Configure basic securesystemslib top-level logger
Configure basic securesystemslib top-level logger

As pointed out by @FlorianVeaux in #210, securesystemslib does not
correctly initialize its loggers. As a consequence the logging
module logs a one-off "No handler could be found ..." warning when
used for the first time (only on Python 2).

The logging module then calls basicConfig, which attaches a
basic StreamHandler to the root logger, to which securesystemslib's
log messages are propagated.

This commit adds the configuration of a simple securesystemslib
top-level logger, with an attached StreamHandler and log level
WARNING, to which all other securesystemslib loggers default.

This removes the one-off warning, while providing a similar logging
behavior as before and clear instructions (see added comments) on
how to customize (format, silence, etc...) securesystemslib's logging.
