Skip to content

Commit

Permalink
atvlog: Rename log2html and bundle it (#982)
Browse files Browse the repository at this point in the history
The log2html script can be quite handy to have, so from now on it's
bundled with pyatv. It is also renamed to atvlog to conform to naming
scheme for other scripts. It also opens up for other log related
functionality, which not necessarily involves HTML.
  • Loading branch information
postlund authored Feb 25, 2021
1 parent 34d2f53 commit 7464cb7
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 3 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/log.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install pygithub
- name: Install python packages
run: |
pip install pygithub
python setup.py develop
- uses: jannekem/run-python-script-action@v1
with:
fail-on-error: false
Expand Down Expand Up @@ -49,7 +50,7 @@ jobs:
fi
if [ -e "body" ]; then
python scripts/log2html.py --output ${base_name}.html --format markdown body
atvlog --output ${base_name}.html --format markdown body
fi
- name: Check if log exists
id: check_files
Expand Down
2 changes: 2 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ page_links:
title: atvproxy
- link: /documentation/atvscript/
title: atvscript
- link: /documentation/atvlog/
title: atvlog
development:
- link: /development/
title: Start
Expand Down
47 changes: 47 additions & 0 deletions docs/documentation/atvlog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
layout: template
title: atvlog
permalink: /documentation/atvlog/
link_group: documentation
---
# atvlog

The `atvlog` script simplifies log inspection by generating an HTML file with basic
live filtering capabilities.

*Note: This is an incubating script and may change behavior with short notice.*

## Features

Log output from the following tools are supported as input:

* atvremote and atvscript
* Home Assistant log

A special `markdown` mode is supported, which extracts a log from the following
format:

~~~
text here is ignored
```log
log data here
```
also ignored
~~~

Filtering can be performed on the following attributes:

* Include entries based on regexp
* Exclude entries based on regexp (performed prior to include regexp)
* Log levels
* Date can be stripped for more compact log

## Examples

```shell
$ atvlog pyatv.log # Print output to stdout
$ atvlog --output pyatv.html pyatv.log
$ cat pyatv.log | atvlog - # Read from stdin
$ cat markdown.log | atvlog --format=markdown -
```

File renamed without changes.
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def get_requirements():
"console_scripts": [
"atvremote = pyatv.scripts.atvremote:main",
"atvproxy = pyatv.scripts.atvproxy:main",
"atvscript = pyatv.scripts.atvscript:main"
"atvscript = pyatv.scripts.atvscript:main",
"atvlog = pyatv.scripts.atvlog:main",
]
},
classifiers=[
Expand Down

0 comments on commit 7464cb7

Please sign in to comment.