make logging not use f-str, change others to f-str (#22882)

This commit is contained in:
Asuka Minato
2025-07-25 11:32:48 +09:00
committed by GitHub
parent 570aee5fe6
commit a189d293f8
164 changed files with 557 additions and 563 deletions

View File

@@ -36,7 +36,7 @@ class StreamProcessor(ABC):
reachable_node_ids: list[str] = []
unreachable_first_node_ids: list[str] = []
if finished_node_id not in self.graph.edge_mapping:
logger.warning(f"node {finished_node_id} has no edge mapping")
logger.warning("node %s has no edge mapping", finished_node_id)
return
for edge in self.graph.edge_mapping[finished_node_id]:
if (

View File

@@ -65,7 +65,7 @@ class BaseNode:
try:
result = self._run()
except Exception as e:
logger.exception(f"Node {self.node_id} failed to run")
logger.exception("Node %s failed to run", self.node_id)
result = NodeRunResult(
status=WorkflowNodeExecutionStatus.FAILED,
error=str(e),

View File

@@ -363,7 +363,7 @@ def _extract_text_from_docx(file_content: bytes) -> str:
text.append(markdown_table)
except Exception as e:
logger.warning(f"Failed to extract table from DOC: {e}")
logger.warning("Failed to extract table from DOC: %s", e)
continue
return "\n".join(text)

View File

@@ -129,7 +129,7 @@ class HttpRequestNode(BaseNode):
},
)
except HttpRequestNodeError as e:
logger.warning(f"http request node {self.node_id} failed to run: {e}")
logger.warning("http request node %s failed to run: %s", self.node_id, e)
return NodeRunResult(
status=WorkflowNodeExecutionStatus.FAILED,
error=str(e),

View File

@@ -129,7 +129,7 @@ class IfElseNode(BaseNode):
var_mapping: dict[str, list[str]] = {}
for case in typed_node_data.cases or []:
for condition in case.conditions:
key = "{}.#{}#".format(node_id, ".".join(condition.variable_selector))
key = f"{node_id}.#{'.'.join(condition.variable_selector)}#"
var_mapping[key] = condition.variable_selector
return var_mapping

View File

@@ -616,7 +616,7 @@ class IterationNode(BaseNode):
)
except IterationNodeError as e:
logger.warning(f"Iteration run failed:{str(e)}")
logger.warning("Iteration run failed:%s", str(e))
yield IterationRunFailedEvent(
iteration_id=self.id,
iteration_node_id=self.node_id,

View File

@@ -670,7 +670,7 @@ class ParameterExtractorNode(BaseNode):
return cast(dict, json.loads(json_str))
except Exception:
pass
logger.info(f"extra error: {result}")
logger.info("extra error: %s", result)
return None
def _extract_json_from_tool_call(self, tool_call: AssistantPromptMessage.ToolCall) -> Optional[dict]:
@@ -690,7 +690,7 @@ class ParameterExtractorNode(BaseNode):
return cast(dict, json.loads(json_str))
except Exception:
pass
logger.info(f"extra error: {result}")
logger.info("extra error: %s", result)
return None
def _generate_default_result(self, data: ParameterExtractorNodeData) -> dict: