简体   繁体   English

如何在扭曲的线程中写入文件中的消息?

[英]How to write messages in file from threads in twisted?

I want to write a custom log file this simple string, but log.msg write all events from script. 我想写一个自定义日志文件这个简单的字符串,但log.msg从脚本中写入所有事件。 How to made a third custom log file ? 如何制作第三个自定义日志文件? ( log.err, log.msg, log.custom ) ? (log.err,log.msg,log.custom)?

Have you seen the logging module? 你见过记录模块吗? It allows you to log to several files at the same time. 它允许您同时登录多个文件。 Or are you simply redirecting output from stdout? 或者您只是从stdout重定向输出? In that case, you could set sys.stdout to your own subclass of StringIO and override the write method to write to several files. 在这种情况下,您可以将sys.stdout设置为您自己的StringIO子类,并覆盖write方法以写入多个文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM