https://github.com/lochbrunner/trace_event_handler
Python Logging Handler which dumps in the Trace Event Format supported by Chromium based browsers.
https://github.com/lochbrunner/trace_event_handler
logging trace-event-format
Last synced: 4 months ago
JSON representation
Python Logging Handler which dumps in the Trace Event Format supported by Chromium based browsers.
- Host: GitHub
- URL: https://github.com/lochbrunner/trace_event_handler
- Owner: lochbrunner
- License: mit
- Created: 2020-02-15T11:05:40.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-29T08:55:49.000Z (almost 6 years ago)
- Last Synced: 2025-02-16T05:04:22.680Z (11 months ago)
- Topics: logging, trace-event-format
- Language: Python
- Size: 77.1 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://pypi.org/project/trace-event-handler/)

[](https://pypi.org/project/trace-event-handler/)

# Logging Handler writing Trace Event Format
This logging writes the logs in the [Trace Event Format](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/).

## Installation
```zsh
pip install trace-event-handler
```
## Usage
```python
import logging
from trace_event_handler import TraceEventHandler
handler = TraceEventHandler()
logging.basicConfig(
handlers=[
logging.StreamHandler(None),
handler
]
)
# Do your stuff and log it
# ...
# Dump the trace to file
handler.dump('trace.json')
```
Open your Chromium based browser and navigate to `chrome://tracing`.
Click on `Load` and select your dumped trace file.
The [example](https://github.com/lochbrunner/trace_event_handler/blob/master/example.py) leads to the trace seen in the figure above.
## Publishing manually
```zsh
python3 setup.py sdist bdist_wheel
python3 -m twine upload dist/*
```