mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Pass format arguments to logger
This commit is contained in:
parent
e58dd58f35
commit
c973de391e
@ -259,8 +259,14 @@ class CObject(ObjectDescription[ASTDeclaration]):
|
|||||||
self.env.temp_data['c:last_symbol'] = e.symbol
|
self.env.temp_data['c:last_symbol'] = e.symbol
|
||||||
msg = __("Duplicate C declaration, also defined at %s:%s.\n"
|
msg = __("Duplicate C declaration, also defined at %s:%s.\n"
|
||||||
"Declaration is '.. c:%s:: %s'.")
|
"Declaration is '.. c:%s:: %s'.")
|
||||||
msg = msg % (e.symbol.docname, e.symbol.line, self.display_object_type, sig)
|
logger.warning(
|
||||||
logger.warning(msg, location=signode)
|
msg,
|
||||||
|
e.symbol.docname,
|
||||||
|
e.symbol.line,
|
||||||
|
self.display_object_type,
|
||||||
|
sig,
|
||||||
|
location=signode,
|
||||||
|
)
|
||||||
|
|
||||||
if ast.objectType == 'enumerator':
|
if ast.objectType == 'enumerator':
|
||||||
self._add_enumerator_to_parent(ast)
|
self._add_enumerator_to_parent(ast)
|
||||||
|
@ -508,9 +508,14 @@ class Symbol:
|
|||||||
name = str(ourChild.declaration)
|
name = str(ourChild.declaration)
|
||||||
msg = __("Duplicate C declaration, also defined at %s:%s.\n"
|
msg = __("Duplicate C declaration, also defined at %s:%s.\n"
|
||||||
"Declaration is '.. c:%s:: %s'.")
|
"Declaration is '.. c:%s:: %s'.")
|
||||||
msg = msg % (ourChild.docname, ourChild.line,
|
logger.warning(
|
||||||
ourChild.declaration.directiveType, name)
|
msg,
|
||||||
logger.warning(msg, location=(otherChild.docname, otherChild.line))
|
ourChild.docname,
|
||||||
|
ourChild.line,
|
||||||
|
ourChild.declaration.directiveType,
|
||||||
|
name,
|
||||||
|
location=(otherChild.docname, otherChild.line),
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
# Both have declarations, and in the same docname.
|
# Both have declarations, and in the same docname.
|
||||||
# This can apparently happen, it should be safe to
|
# This can apparently happen, it should be safe to
|
||||||
|
@ -359,9 +359,14 @@ class CPPObject(ObjectDescription[ASTDeclaration]):
|
|||||||
self.env.temp_data['cpp:last_symbol'] = e.symbol
|
self.env.temp_data['cpp:last_symbol'] = e.symbol
|
||||||
msg = __("Duplicate C++ declaration, also defined at %s:%s.\n"
|
msg = __("Duplicate C++ declaration, also defined at %s:%s.\n"
|
||||||
"Declaration is '.. cpp:%s:: %s'.")
|
"Declaration is '.. cpp:%s:: %s'.")
|
||||||
msg = msg % (e.symbol.docname, e.symbol.line,
|
logger.warning(
|
||||||
self.display_object_type, sig)
|
msg,
|
||||||
logger.warning(msg, location=signode)
|
e.symbol.docname,
|
||||||
|
e.symbol.line,
|
||||||
|
self.display_object_type,
|
||||||
|
sig,
|
||||||
|
location=signode,
|
||||||
|
)
|
||||||
|
|
||||||
if ast.objectType == 'enumerator':
|
if ast.objectType == 'enumerator':
|
||||||
self._add_enumerator_to_parent(ast)
|
self._add_enumerator_to_parent(ast)
|
||||||
|
@ -792,9 +792,14 @@ class Symbol:
|
|||||||
name = str(ourChild.declaration)
|
name = str(ourChild.declaration)
|
||||||
msg = __("Duplicate C++ declaration, also defined at %s:%s.\n"
|
msg = __("Duplicate C++ declaration, also defined at %s:%s.\n"
|
||||||
"Declaration is '.. cpp:%s:: %s'.")
|
"Declaration is '.. cpp:%s:: %s'.")
|
||||||
msg = msg % (ourChild.docname, ourChild.line,
|
logger.warning(
|
||||||
ourChild.declaration.directiveType, name)
|
msg,
|
||||||
logger.warning(msg, location=(otherChild.docname, otherChild.line))
|
ourChild.docname,
|
||||||
|
ourChild.line,
|
||||||
|
ourChild.declaration.directiveType,
|
||||||
|
name,
|
||||||
|
location=(otherChild.docname, otherChild.line),
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
if (otherChild.declaration.objectType ==
|
if (otherChild.declaration.objectType ==
|
||||||
ourChild.declaration.objectType and
|
ourChild.declaration.objectType and
|
||||||
|
Loading…
Reference in New Issue
Block a user