Commit 5c654e95 authored by Iustin Pop's avatar Iustin Pop

setup-ssh: redo the logging levels

There is not enough logged by default on stderr, and way too much
information in the log file.

Since we don't want to debug paramiko itself, we filter only warnings
and above.

Otherwise, we make WARNINGS the default level, with verbose meaning INFO
and debug, well, DEBUG.

Additionally, a message is improved.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarManuel Franceschini <livewire@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 7bff16bd
......@@ -129,7 +129,7 @@ def SetupSSH(transport):
except IOError:
# Sadly paramiko doesn't provide errno or similiar
# so we can just assume that the path already exists
logging.info("Path %s seems already to exist on remote node. Ignore.",
logging.info("Path %s seems already to exist on remote node. Ignoring.",
auth_path)
for name, (data, perm) in filemap.iteritems():
......@@ -192,23 +192,25 @@ def SetupLogging(options):
stderr_handler = logging.StreamHandler()
stderr_handler.setFormatter(formatter)
file_handler.setFormatter(formatter)
file_handler.setLevel(logging.DEBUG)
file_handler.setLevel(logging.INFO)
if options.debug:
stderr_handler.setLevel(logging.NOTSET)
stderr_handler.setLevel(logging.DEBUG)
elif options.verbose:
stderr_handler.setLevel(logging.INFO)
else:
stderr_handler.setLevel(logging.ERROR)
stderr_handler.setLevel(logging.WARNING)
root_logger = logging.getLogger("")
root_logger.setLevel(logging.NOTSET)
root_logger.setLevel(logging.INFO)
root_logger.addHandler(stderr_handler)
root_logger.addHandler(file_handler)
# This is the paramiko logger instance
paramiko_logger = logging.getLogger("paramiko")
paramiko_logger.addHandler(file_handler)
# We don't want to debug Paramiko, so filter anything below warning
paramiko_logger.setLevel(logging.WARNING)
def main():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment