logging: port to standard Python logging

Use the standard `logging` module to configure logging instead of the
in-house `ipapython.log_manager` module and remove `ipapython.log_manager`.

Disable the logging-not-lazy and logging-format-interpolation pylint
checks.

Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Jan Cholasta
2016-09-14 15:45:50 +02:00
committed by Martin Basti
parent 464516489f
commit f62a0fdb90
9 changed files with 152 additions and 1743 deletions

View File

@@ -22,6 +22,7 @@
Handles common operations like option parsing and logging
"""
import logging
import sys
import os
import traceback
@@ -230,8 +231,12 @@ class AdminTool(object):
Logging to file is only set up after option validation and prompting;
before that, all output will go to the console only.
"""
if 'console' in ipa_log_manager.log_mgr.handlers:
ipa_log_manager.log_mgr.remove_handler('console')
root_logger = ipa_log_manager.root_logger
for handler in root_logger.handlers:
if (isinstance(handler, logging.StreamHandler) and
handler.stream is sys.stderr): # pylint: disable=no-member
root_logger.removeHandler(handler)
break
self._setup_logging(log_file_mode=log_file_mode)