Improve ipa-client-install debug output

The client does a fair bit of work when trying to validate the hostnames,
do discovery and verify that the server it gets back is an IPA server.
The debug logging around this was horrid with very little state information,
duplicate log messages or just nothing at all.
In many cases errors were printed only to stderr/stdout.

This patch makes the logging and output go through the IPA log manager.
It sets up logging so that INFO, WARNING, and ERROR messages show up on the
console. If -d is given, DEBUG messages are also printed.
All messages also go to the log file.
The only exception is user input: prompts are only printed to the console,
but if the user provides any information it is echoed in a DEBUG-level
message.

https://fedorahosted.org/freeipa/ticket/2553
This commit is contained in:
Petr Viktorin
2012-06-08 09:36:38 -04:00
committed by Rob Crittenden
parent e94733f04d
commit 3e0116491f
2 changed files with 279 additions and 199 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -171,7 +171,8 @@ class IPALogManager(LogManager):
#-------------------------------------------------------------------------------
def standard_logging_setup(filename=None, verbose=False, debug=False, filemode='w'):
def standard_logging_setup(filename=None, verbose=False, debug=False,
filemode='w', console_format=LOGGING_FORMAT_STANDARD_CONSOLE):
handlers = []
# File output is always logged at debug level
@@ -195,7 +196,7 @@ def standard_logging_setup(filename=None, verbose=False, debug=False, filemode='
console_handler = dict(name='console',
stream=sys.stderr,
level=level,
format=LOGGING_FORMAT_STANDARD_CONSOLE)
format=console_format)
handlers.append(console_handler)