通过 Python 在大型脚本中记录每个步骤和操作
我最后创建了一个大的 python 脚本。但现在我需要一个记录器。我在脚本中有输入步骤、提示..函数调用..While循环..等。
而且,记录器也必须记录成功操作。
我找不到适合我的答案。我又上网查了一下,也想问问你。
你的意见是什么?
谢谢
I have created a large python script at the end. But now I need a logger for it. I have input steps, prompts.. Function calls.. While Loops.., etc. in the script.
And also, the logger is have to log success operations too.
I couldn't find a suitable answer for me. I'm searching on the internet again, and wanted to ask you too.
Whats your opinion?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
标准库中有一个模块
logging
。基本使用方法非常简单;在每个需要进行日志记录的模块中,放置并记录,例如,
然后在主模块中,放置类似
打印严重性为
INFO
或更严重的标准错误的所有日志。该模块非常可配置,请参阅其文档了解详细信息。There's a module
logging
in the standard library. Basic usage is very simple; in every module that needs to do logging, putand log with, e.g.,
Then in the main module, put something like
to print all logs with a severity of
INFO
or worse to standard error. The module is very configurable, see its documentation for details.