如何为每个函数调用获取不同的记录器?

2024-05-23 13:50:38 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要一个不同的记录器为每个调用相同的功能。你知道吗

loggerA = logging.getLogger('whatever1')
myfunction('A')
loggerB = logging.getLogger('whatever2')
myfunction('B')
# The loggers must not cross

如何组织登录myfunction?有可能吗?你知道吗


Tags: the功能loggingnotloggers记录器crossmust