mirror of
https://github.com/Nezumi-2711/astrbot_plugin_qq_group_daily_analysis.git
synced 2026-09-22 13:38:43 +00:00
fix(logger): 注入 TraceID
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
from astrbot.api import logger as astrbot_logger
|
from astrbot.api import logger as astrbot_logger
|
||||||
|
|
||||||
|
from ..shared.trace_context import TraceContext
|
||||||
|
|
||||||
|
|
||||||
class PluginLogger:
|
class PluginLogger:
|
||||||
"""
|
"""
|
||||||
@@ -14,6 +16,9 @@ class PluginLogger:
|
|||||||
self.prefix = prefix
|
self.prefix = prefix
|
||||||
|
|
||||||
def _format_msg(self, msg: str) -> str:
|
def _format_msg(self, msg: str) -> str:
|
||||||
|
trace_id = TraceContext.get()
|
||||||
|
if trace_id:
|
||||||
|
return f"[{trace_id}] {self.prefix} {msg}"
|
||||||
return f"{self.prefix} {msg}"
|
return f"{self.prefix} {msg}"
|
||||||
|
|
||||||
def info(self, msg: str, *args, **kwargs):
|
def info(self, msg: str, *args, **kwargs):
|
||||||
|
|||||||
Reference in New Issue
Block a user