summaryrefslogtreecommitdiff
path: root/sphinx/util/logging.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/util/logging.py')
-rw-r--r--sphinx/util/logging.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/sphinx/util/logging.py b/sphinx/util/logging.py
index 2cdac6c40..7fb5c5894 100644
--- a/sphinx/util/logging.py
+++ b/sphinx/util/logging.py
@@ -356,11 +356,15 @@ class WarningIsErrorFilter(logging.Filter):
return True
elif self.app.warningiserror:
location = getattr(record, 'location', '')
- message = record.msg.replace('%', '%%')
+ try:
+ message = record.msg % record.args
+ except TypeError:
+ message = record.msg # use record.msg itself
+
if location:
- raise SphinxWarning(location + ":" + message % record.args)
+ raise SphinxWarning(location + ":" + message)
else:
- raise SphinxWarning(message % record.args)
+ raise SphinxWarning(message)
else:
return True