Python Syslog添加标签和设施
我正在使用python syslog 库。我想在日志中添加标签
和功能
。但是,似乎没有一种添加标签
的方法。
有一个功能
参数,但是我需要一个自定义字符串。
有没有办法实现以下内容:
import syslog
syslog.openlog(logoption=syslog.LOG_PID, facility="myapp", tag="mytag")
syslog.syslog('myapp processing initiated...')
I am using the python syslog library. I want to add a tag
and facility
to the log. But there doesn't seem to be a way to add a tag
.
There is a facility
argument, but I need a custom string.
Is there a way to achieve something like the following:
import syslog
syslog.openlog(logoption=syslog.LOG_PID, facility="myapp", tag="mytag")
syslog.syslog('myapp processing initiated...')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
python
syslog
库没有标签
参数。相反,您可以使用
distions
参数。功能
而不是“ myApp”之类的字符串。这是应将日志写入的文件。The python
syslog
library doesn't have atag
argument.Instead you can use the
ident
argument.The
facility
instead cannot be a string like "myapp". It's the file where the logs should be written to.