more debug logs for free, network_cli, paramiko and add hostname context to debugging messages (#39205)

* Add hostname context to debugging messages
* Set paramiko's channel
This commit is contained in:
jctanner 2018-04-26 17:10:28 -04:00 committed by GitHub
commit bbfe7a8b2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 11 deletions

View file

@ -191,9 +191,12 @@ class Display:
def vvvvvv(self, msg, host=None):
return self.verbose(msg, host=host, caplevel=5)
def debug(self, msg):
def debug(self, msg, host=None):
if C.DEFAULT_DEBUG:
self.display("%6d %0.5f: %s" % (os.getpid(), time.time(), msg), color=C.COLOR_DEBUG)
if host is None:
self.display("%6d %0.5f: %s" % (os.getpid(), time.time(), msg), color=C.COLOR_DEBUG)
else:
self.display("%6d %0.5f [%s]: %s" % (os.getpid(), time.time(), host, msg), color=C.COLOR_DEBUG)
def verbose(self, msg, host=None, caplevel=2):
if self.verbosity > caplevel: