将eliot日志呈现为ascii树

eliot-tree的Python项目详细描述


buildcoverage

Eliot日志呈现为ascii树。

此输出:

https://github.com/jonathanj/eliottree/raw/18.1.0/doc/example_eliot_log.png

(或作为文本)

$ eliot-tree eliot.log
f3a32bb3-ea6b-457c-aa99-08a3d0491ab4
└── app:soap:client:request/1 ⇒ started 2015-03-03 04:28:56 ⧖ 1.238s
    ├── dump: /home/user/dump_files/20150303/1425356936.28_Client_req.xml
    ├── soapAction: a_soap_action
    ├── uri: http://example.org/soap
    ├── app:soap:client:success/2/1 ⇒ started 2015-03-03 04:28:57 ⧖ 0.000s
    │   └── app:soap:client:success/2/2 ⇒ succeeded 2015-03-03 04:28:57
    │       └── dump: /home/user/dump_files/20150303/1425356937.52_Client_res.xml
    └── app:soap:client:request/3 ⇒ succeeded 2015-03-03 04:28:57
        └── status: 200

 89a56df5-d808-4a7c-8526-e603aae2e2f2
 └── app:soap:service:request/1 ⇒ started 2015-03-03 04:31:08 ⧖ 3.482s
     ├── dump: /home/user/dump_files/20150303/1425357068.03_Service_req.xml
     ├── soapAction: method
     ├── uri: /endpoints/soap/method
     ├── app:soap:service:success/2/1 ⇒ started 2015-03-03 04:31:11 ⧖ 0.001s
     │   └── app:soap:service:success/2/2 ⇒ succeeded 2015-03-03 04:31:11
     │       └── dump: /home/user/dump_files/20150303/1425357071.51_Service_res.xml
     └── app:soap:service:request/3 ⇒ succeeded 2015-03-03 04:31:11
         └── status: 200

生成于:

{"dump":"/home/user/dump_files/20150303/1425356936.28_Client_req.xml","timestamp":1425356936.278875,"uri":"http://example.org/soap","action_status":"started","task_uuid":"f3a32bb3-ea6b-457c-aa99-08a3d0491ab4","action_type":"app:soap:client:request","soapAction":"a_soap_action","task_level":[1]}{"timestamp":1425356937.516579,"task_uuid":"f3a32bb3-ea6b-457c-aa99-08a3d0491ab4","action_type":"app:soap:client:success","action_status":"started","task_level":[2,1]}{"task_uuid":"f3a32bb3-ea6b-457c-aa99-08a3d0491ab4","action_type":"app:soap:client:success","dump":"/home/user/dump_files/20150303/1425356937.52_Client_res.xml","timestamp":1425356937.517077,"action_status":"succeeded","task_level":[2,2]}{"status":200,"task_uuid":"f3a32bb3-ea6b-457c-aa99-08a3d0491ab4","task_level":[3],"action_type":"app:soap:client:request","timestamp":1425356937.517161,"action_status":"succeeded"}{"dump":"/home/user/dump_files/20150303/1425357068.03_Service_req.xml","timestamp":1425357068.032091,"uri":"/endpoints/soap/method","action_status":"started","task_uuid":"89a56df5-d808-4a7c-8526-e603aae2e2f2","action_type":"app:soap:service:request","soapAction":"method","task_level":[1]}{"timestamp":1425357071.51233,"task_uuid":"89a56df5-d808-4a7c-8526-e603aae2e2f2","action_type":"app:soap:service:success","action_status":"started","task_level":[2,1]}{"task_uuid":"89a56df5-d808-4a7c-8526-e603aae2e2f2","action_type":"app:soap:service:success","dump":"/home/user/dump_files/20150303/1425357071.51_Service_res.xml","timestamp":1425357071.513453,"action_status":"succeeded","task_level":[2,2]}{"status":200,"task_uuid":"89a56df5-d808-4a7c-8526-e603aae2e2f2","task_level":[3],"action_type":"app:soap:service:request","timestamp":1425357071.513992,"action_status":"succeeded"}

流媒体

例如,可以从尾随日志将数据导入到eliot树中,并且 让它逐渐呈现出来。但是有一个警告:树只是 一次呈现结束消息-树根的成功或失败状态 操作出现在数据中。

来自python的用法

importjson,sysfromeliottreeimporttasks_from_iterable,render_tasks# Or `codecs.getwriter('utf-8')(sys.stdout).write` on Python 2.render_tasks(sys.stdout.write,tasks,colorize=True)

请参阅help(render_tasks)help(tasks_from_iterable)来自 python repl了解更多信息。

从命令行使用

$ eliot-tree
usage: eliot-tree [-h] [-u UUID] [-i KEY] [--raw]
                  [--color {always,auto,never}] [--no-colorize] [-l LENGTH]
                  [--select QUERY] [--start START] [--end END]
                  [FILE [FILE ...]]

Display an Eliot log as a tree of tasks.

positional arguments:
  FILE                  Files to process. Omit to read from stdin.

optional arguments:
  -h, --help            show this help message and exit
  -u UUID, --task-uuid UUID
                        Select a specific task by UUID
  -i KEY, --ignore-task-key KEY
                        Ignore a task key, use multiple times to ignore
                        multiple keys. Defaults to ignoring most Eliot
                        standard keys.
  --raw                 Do not format some task values (such as UTC
                        timestamps) as human-readable
  --color {always,auto,never}
                        Color the output. Defaults based on whether the output
                        is a TTY.
  -l LENGTH, --field-limit LENGTH
                        Limit the length of field values to LENGTH or a
                        newline, whichever comes first. Use a length of 0 to
                        output the complete value.
  --select QUERY        Select tasks to be displayed based on a jmespath
                        query, can be specified multiple times to mimic
                        logical AND. If any child task is selected the entire
                        top-level task is selected. See <http://jmespath.org/>
  --start START         Select tasks whose timestamp occurs after (or on) an
                        ISO8601 date.
  --end END             Select tasks whose timestamp occurs before an ISO8601
                        date.

贡献

有关详细信息,请参见<;https://github.com/jonathanj/eliottree>;。

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

推荐PyPI第三方库


热门话题
datetime如何使用JodaTime在Java中设置时间属性   java固定算法的性能时间   java如何从JMenu中获取所选项以更改文本区域的文本颜色?   java配置单元UDF传递数组<string>作为参数   javaapachebeam和BigQuery   java与PrintWriter之间的差异。printf和PrintWriter。格式方法   继承如何处理按Java版本更改的导入,以及在多个版本上编译   xml java。lang.noClassDefFoundant生成错误   java如何使用包含映射的JSON发送POST请求?   java如何在任何应用程序的JAR文件中绑定MySql数据库?   Java脚本解释器   sslhttpclientjava。网SocketException:未实现未连接的socket   java如何为Android应用程序创建类似于Cron作业的东西   java JButton+radiobox+复选框   java内存管理将文件写入内存   java这是计算对象实例的有效方法吗?   用于死锁情况的java代码?   JavaSpring容器作为新实体插入,而不是存储在表中