Skip to content

Commit

Permalink
Fix inadvertent formatter errors when % is present in widget path
Browse files Browse the repository at this point in the history
  • Loading branch information
Milan Falešník committed Jan 10, 2018
1 parent 31f4e86 commit 9b168be
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 9b168be

Please sign in to comment.