summaryrefslogtreecommitdiff
path: root/morphlib/app.py
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/app.py')
-rw-r--r--morphlib/app.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index 8fd52a46..187675cd 100644
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -342,7 +342,12 @@ class Morph(cliapp.Application):
'''
assert 'msg' in kwargs
- text = self.status_prefix + (kwargs['msg'] % kwargs)
+ msg = kwargs['msg'] % kwargs
+
+ logger = logging.getLogger()
+ fmt = '%(asctime)s %(levelname)s ' + self.status_prefix + '%(message)s'
+ datefmt = self.setup_logging_timestamp()
+ logger.handlers[0].setFormatter(logging.Formatter(fmt, datefmt))
error = kwargs.get('error', False)
chatty = kwargs.get('chatty', False)
@@ -350,15 +355,15 @@ class Morph(cliapp.Application):
debug = self.settings['debug']
if error:
- logging.error(text)
+ logging.error(msg)
elif chatty:
- logging.debug(text)
+ logging.debug(msg)
else:
- logging.info(text)
+ logging.info(msg)
ok = debug or error or (not quiet and not chatty)
if ok:
- self._write_status(text)
+ self._write_status("%s%s" % (self.status_prefix, msg))
def _commandline_as_message(self, argv, args):
'''Create a status string for a command that's about to be executed.'''