Skip to content

Commit

Permalink
Merge pull request #72 from mfalesni/fix-formatter
Browse files Browse the repository at this point in the history
Fix inadvertent formatter errors when % is present in widget path
  • Loading branch information
Milan Falešník committed Jan 10, 2018
2 parents 31f4e86 + 9b168be commit e5e15e2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/widgetastic/log.py
Expand Up @@ -32,7 +32,8 @@ def call_sig(args, kwargs):
class PrependParentsAdapter(logging.LoggerAdapter):
"""This class ensures the path to the widget is represented in the log records."""
def process(self, msg, kwargs):
return '[{}]: {}'.format(self.extra['widget_path'], msg), kwargs
# Sanitizing %->%% for formatter working properly
return '[{}]: {}'.format(self.extra['widget_path'].replace('%', '%%'), msg), kwargs

def __repr__(self):
return '{}({!r}, {!r})'.format(type(self).__name__, self.logger, self.extra['widget_path'])
Expand Down

0 comments on commit e5e15e2

Please sign in to comment.