add a null logging handler

Python libraries that log should set a NullHandler in case the
application where they are used does not set up logging. Reno's use in
the Sphinx extension and in some release tools generates warnings the
first time logging calls are made because of the missing handler.

Change-Id: Ia8455d72f4b5e861d023b541a8ea9db786d53637
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-01-19 16:19:08 -05:00
parent 2bc5dfe355
commit b11e2fbf29
1 changed files with 6 additions and 0 deletions

View File

@ -12,8 +12,14 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
import pbr.version
__version__ = pbr.version.VersionInfo(
'reno').version_string()
# Configure a null logger so that if reno is used as a library by an
# application that does not configure logging there are no warnings.
logging.getLogger(__name__).addHandler(logging.NullHandler())