Allow non-format messages

This commit is contained in:
ZyX 2013-04-07 03:24:39 +04:00
parent 8cb1538e8e
commit 9ce63d1657
1 changed files with 3 additions and 1 deletions

View File

@ -34,7 +34,9 @@ class PowerlineState(object):
def _log(self, attr, msg, *args, **kwargs):
prefix = kwargs.get('prefix') or self.prefix
prefix = self.ext + ((':' + prefix) if prefix else '')
msg = prefix + ':' + msg.format(*args, **kwargs)
if args or kwargs:
msg = msg.format(*args, **kwargs)
msg = prefix + ':' + msg
key = attr + ':' + prefix
if msg != self.last_msgs.get(key):
getattr(self.logger, attr)(msg)