可插拔的扭曲应用程序?
是否存在可插入扭曲应用程序这样的东西,可以将某些人添加到扭曲项目中?网络日志就是这样的一个例子。这是一个网络应用程序,您可以在其中访问日志记录过程的结果。
Is there such a thing as pluggable twisted apps some one can add to a twisted project? One example of this could be a web logging. That's a web app where you can access the results of your logging process.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
整个 Twisted 上没有撒上任何魔法灰尘,可以让你将任意钩子插入任意位置(或者......有,它被称为“猴子修补”)。
不过,特定的接口有特定的扩展方法。例如,日志系统基于发出的事件以及将这些事件传递到的观察者列表。您可以使用您喜欢的任何行为添加新观察者。
每个这样的扩展点都需要以自己的方式处理。因此,首先确定您想要扩展的内容,然后查找其文档(或者,如有必要,阅读其实现),然后使用您所学到的知识来扩展它。或者,如果行为无法按照您想要的方式自定义,请提交增强请求。
There's no magic dust sprinkled over the whole of Twisted which will let you insert arbitrary hooks into arbitrary places (Or... there is, it's called "monkey patching").
Specific interfaces have specific ways in which you can extend them, though. For example, the logging system is based on events which are emitted and a list of observers to which those events are delivered. You can add new observers with whatever behavior you like.
Each such point of extension needs to be dealt with in its own way. So first identify the thing you want to extend, then look for its documentation (or, if necessary, read its implementation), then use what you've learned to extend it. Or file an enhancement request if the behavior is not customizable in the way you want.