Jonathan,
Fantastic tool! I have been making great use of it!
I have an application which logs debug events when a debug option is enabled. I've been experimenting with the idea of always logging the debug information, and filtering the debug events out of the log when I don't want/need to see them. I found that if I delete an event it can cause eliot-tree to render the associated task out of (chronological) order (presumably because the parser is waiting for the missing event to show up in the log data, and then eventually gives up?)
Here's an example:
from eliot import start_action, to_file, Message
import subprocess
to_file(open("normal.log", "w"))
with start_action(action_type="first_action"):
Message.log(message_type="some_message", level='debug')
Message.log(message_type="some_message", level='info')
with start_action(action_type="second_action"):
pass
# Create a version of the log file in which the 'debug' event has been deleted
with open('normal.log') as file:
with open('filtered.log', 'w') as filtered_file:
for line in file:
if 'debug' not in line:
filtered_file.write(line)
subprocess.call('eliot-tree --color never normal.log > normal.tree', shell=True)
subprocess.call('eliot-tree --color never filtered.log > filtered.tree', shell=True)
Which results in:
normal.tree
ceed1fcb-51fc-42a6-8219-e3157e98b402
└── first_action/1 ⇒ started
├── timestamp: 2017-11-04 02:31:24.041994
├── some_message/2
│ ├── level: debug
│ └── timestamp: 2017-11-04 02:31:24.042184
├── some_message/3
│ ├── level: info
│ └── timestamp: 2017-11-04 02:31:24.042294
└── first_action/4 ⇒ succeeded
└── timestamp: 2017-11-04 02:31:24.042397
47d6d5a3-4f7c-4276-8bae-014a9a2e2875
└── second_action/1 ⇒ started
├── timestamp: 2017-11-04 02:31:24.042547
└── second_action/2 ⇒ succeeded
└── timestamp: 2017-11-04 02:31:24.042654
filtered.tree
47d6d5a3-4f7c-4276-8bae-014a9a2e2875
└── second_action/1 ⇒ started
├── timestamp: 2017-11-04 02:31:24.042547
└── second_action/2 ⇒ succeeded
└── timestamp: 2017-11-04 02:31:24.042654
ceed1fcb-51fc-42a6-8219-e3157e98b402
└── first_action/1 ⇒ started
├── timestamp: 2017-11-04 02:31:24.041994
├── some_message/3
│ ├── level: info
│ └── timestamp: 2017-11-04 02:31:24.042294
└── first_action/4 ⇒ succeeded
└── timestamp: 2017-11-04 02:31:24.042397
Perhaps I am crazy to be trying to filter events, but it seems so close to working that I thought I'd ask what you thought.
Cheers!
Jonathan,
Fantastic tool! I have been making great use of it!
I have an application which logs debug events when a debug option is enabled. I've been experimenting with the idea of always logging the debug information, and filtering the debug events out of the log when I don't want/need to see them. I found that if I delete an event it can cause eliot-tree to render the associated task out of (chronological) order (presumably because the parser is waiting for the missing event to show up in the log data, and then eventually gives up?)
Here's an example:
Which results in:
normal.tree
filtered.tree
Perhaps I am crazy to be trying to filter events, but it seems so close to working that I thought I'd ask what you thought.
Cheers!