aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Capitani <m.capitani@nextworks.it>2017-06-15 12:54:04 +0200
committerMarco Capitani <m.capitani@nextworks.it>2017-06-15 12:54:04 +0200
commitd2744740a682701d3f1f714c15fe4265f4e7a495 (patch)
tree59f4e9ed22ebe63f93fc5562ab82b7329536bf5a
parent3ada31d1f6c112e1338225eacc982f6dc885292e (diff)
downloadrumba-d2744740a682701d3f1f714c15fe4265f4e7a495.tar.gz
rumba-d2744740a682701d3f1f714c15fe4265f4e7a495.zip
ssh_support + log: fixes for python 2 compatibility
-rw-r--r--rumba/log.py15
-rw-r--r--rumba/ssh_support.py2
2 files changed, 8 insertions, 9 deletions
diff --git a/rumba/log.py b/rumba/log.py
index d95c034..bed0170 100644
--- a/rumba/log.py
+++ b/rumba/log.py
@@ -40,9 +40,8 @@ class RumbaFormatter(logging.Formatter):
def __init__(self):
super(RumbaFormatter, self).__init__(
- fmt='{asctime} | {levelname:3.3} | '
- '{name:11.11} | {message}',
- style='{',
+ fmt='%(asctime)s | %(levelname)3.3s | '
+ '%(name)11.11s | %(message)s',
datefmt='%H:%M:%S')
def format(self, record):
@@ -95,11 +94,11 @@ def set_logging_level(level, name=None):
"""
Set the current logging level to <level> for logger named <name>.
If name is not specified, sets the logging level for all rumba loggers.
- Accepted levels are:
- DEBUG == 10,
- INFO == 20,
- WARNING == 30,
- ERROR == 40,
+ Accepted levels are:
+ DEBUG == 10,
+ INFO == 20,
+ WARNING == 30,
+ ERROR == 40,
CRITICAL == 50,
NOTSET == 0
(resets the logger: its level is set to the default or its parents' level)
diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py
index a1e1ba4..b0970e1 100644
--- a/rumba/ssh_support.py
+++ b/rumba/ssh_support.py
@@ -40,7 +40,7 @@ def _print_stream(stream):
o_array = o.split('\\n')
for oi in o_array:
logger.debug(oi)
- return o
+ return o.rstrip()
def execute_proxy_commands(testbed, ssh_config, commands, time_out=3):