Twisted Scribe客户端/服务器

scrivener的Python项目详细描述


scrivener是一个用于Twisted应用程序的Scribe客户机/服务器框架。

客户端API

fromtwisted.internetimportreactorfromtwisted.internet.endpointsimportTCP4ClientEndpointfromscrivenerimportScribeClientdefmain():client=ScribeClient(TCP4ClientEndpoint(reactor,'127.0.0.1',1234))client.log('category','message1')client.log('category','message2')if__name__=='__main__':reactor.callWhenRunning(main)reactor.run()

服务器API

importsysfromtwisted.internetimportreactorfromtwisted.internet.endpointsimportTCP4ServerEndpointfromtwisted.python.logimportstartLoggingfromscrivenerimportScribeServerServicefromscrivener.handlersimportTwistedLogHandlerdefmain():service=ScribeServerService(TCP4ServerEndpoint(reactor,1234),TwistedLogHandler())service.startService()if__name__=='__main__':startLogging(sys.stdout)reactor.callWhenRunning(main)reactor.run()

服务器插件

> twistd -n scrivener --help
Usage: twistd [options] scrivener [scrivener options]
Options:
  -p, --port=            Port to listen on for scribe service. [default: tcp:0]
  -H, --handlerFactory=  Fully Qualified Name of a callable that returns an
                         ILogHandler
      --version          Display Twisted version and exit.
      --help             Display this help and exit.

> twistd -n scrivener -p 1234 -H example.MyLogHandler

许可证

Copyright (C) 2012 Rackspace Hosting, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
javajaxb在嵌套节点中生成xmlns:xsi声明   java重定向到youtube以上传jsp上可用的视频   java提高了JVM和ANT的性能   java如何将返回的JSON数据放在HTML表单中   java如何发送XWWWFORMURLENCODE在重新授权   java为什么jvm XX:+EliminateAllocations失败   堆移除和重建方法?(爪哇)   Stanford NPL in Spark(Scala)应用程序运行到Java堆空间(Java.lang.OutOfMemoryError)   调试java中打开/关闭println的任何方式(详细模式)   java IntelliJ在鼠标悬停时显示JavaDocs工具提示   Olingo Odata Java中的自动扩展选项   json将postgres文本arry转换为java列表?   oop需要帮助推断Java代码   复选框的java添加操作侦听器AbstractTableModel   java如何从公共静态void main(String[]args)传递值   java从数据库中获取大值   java Processing 2.0电影从jar运行时无法打开电影文件   java如何在不使用应用程序的情况下刷新活动?   尝试将JSON解析为ListView时的Android:JSON parse:null对象引用