tailjlogs 1.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tailjlogs-1.0.4/.github/workflows/publish.yml +28 -0
- tailjlogs-1.0.4/.github/workflows/tests.yml +35 -0
- tailjlogs-1.0.4/.gitignore +207 -0
- tailjlogs-1.0.4/.python-version +1 -0
- tailjlogs-1.0.4/.vscode/settings.json +7 -0
- tailjlogs-1.0.4/CHANGELOG.md +44 -0
- tailjlogs-1.0.4/CLAUDE.md +75 -0
- tailjlogs-1.0.4/LICENSE +21 -0
- tailjlogs-1.0.4/PKG-INFO +178 -0
- tailjlogs-1.0.4/README.md +162 -0
- tailjlogs-1.0.4/main.py +6 -0
- tailjlogs-1.0.4/pyproject.toml +37 -0
- tailjlogs-1.0.4/tailjlogs.py +969 -0
- tailjlogs-1.0.4/tests/__init__.py +1 -0
- tailjlogs-1.0.4/tests/conftest.py +61 -0
- tailjlogs-1.0.4/tests/fixtures/test_data.jsonl +394 -0
- tailjlogs-1.0.4/tests/fixtures/test_data2.jsonl +32 -0
- tailjlogs-1.0.4/tests/test_file_reading.py +109 -0
- tailjlogs-1.0.4/tests/test_formatting.py +188 -0
- tailjlogs-1.0.4/tests/test_integration.py +111 -0
- tailjlogs-1.0.4/tests/test_rotation.py +65 -0
- tailjlogs-1.0.4/uv.lock +592 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
id-token: write # Required for trusted publishing
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Install uv
|
|
17
|
+
uses: astral-sh/setup-uv@v4
|
|
18
|
+
with:
|
|
19
|
+
version: "latest"
|
|
20
|
+
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
run: uv python install 3.13
|
|
23
|
+
|
|
24
|
+
- name: Build package
|
|
25
|
+
run: uv build
|
|
26
|
+
|
|
27
|
+
- name: Publish to PyPI
|
|
28
|
+
run: uv publish --token ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, develop]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, develop]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Install uv
|
|
20
|
+
uses: astral-sh/setup-uv@v4
|
|
21
|
+
with:
|
|
22
|
+
version: "latest"
|
|
23
|
+
|
|
24
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
25
|
+
run: uv python install ${{ matrix.python-version }}
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: uv sync --all-groups
|
|
29
|
+
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: uv run pytest -v --tb=short
|
|
32
|
+
|
|
33
|
+
- name: Run tests with coverage
|
|
34
|
+
run: uv run pytest --cov=tailjlogs --cov-report=term-missing
|
|
35
|
+
continue-on-error: true
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on "Keep a Changelog" and this project adheres to Semantic Versioning.
|
|
6
|
+
|
|
7
|
+
## [1.0.4] - 2026-01-17
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **fix:** Normalize timestamps to timezone-aware UTC datetimes when reading logs so merging/sorting across files does not raise TypeError (naive timestamps are interpreted as UTC).
|
|
12
|
+
- **test:** Add tests to ensure naive and aware timestamps compare consistently.
|
|
13
|
+
|
|
14
|
+
## [1.0.3] - 2026-01-17
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **feat:** Support rotated JSONL log files (e.g., `app.jsonl.1`, `app.jsonl.2`) when tailing directories. (PR #5)
|
|
19
|
+
- **feat:** Dynamically track rotated files during follow mode so rotations are picked up without restarting.
|
|
20
|
+
- **test:** Add tests to validate rotated filename discovery and merged ordering.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- **chore:** Minor improvements to file discovery regex and watcher behavior.
|
|
25
|
+
|
|
26
|
+
## [1.0.2] - 2026-01-17
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- **docs:** Promote PyPI install in the `README.md` and add a PyPI badge. (PR #4)
|
|
31
|
+
- **docs:** Remove duplicate "From PyPI" section to avoid confusion.
|
|
32
|
+
- **chore:** Bump package version to `1.0.2` and publish to PyPI.
|
|
33
|
+
|
|
34
|
+
### CI
|
|
35
|
+
|
|
36
|
+
- **ci:** Publish workflow triggered by release successfully published `v1.0.2` to PyPI.
|
|
37
|
+
|
|
38
|
+
## [1.0.1] - 2026-01-16
|
|
39
|
+
|
|
40
|
+
- Initial PyPI publish and README updates.
|
|
41
|
+
|
|
42
|
+
## [1.0.0] - 2026-01-16
|
|
43
|
+
|
|
44
|
+
- Initial package setup and CLI implementation.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# CLAUDE.md - Project Context for AI Assistants
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
**TailJLogs** is a Python command-line tool for tailing and following JSONL (JSON Lines) log files with pretty formatting. It's similar to `tail -f` but designed specifically for structured JSON log output.
|
|
6
|
+
|
|
7
|
+
## Architecture
|
|
8
|
+
|
|
9
|
+
### Main File: `tailjlogs.py`
|
|
10
|
+
|
|
11
|
+
The entire application is in a single file with these key components:
|
|
12
|
+
|
|
13
|
+
1. **CLI Setup** - Uses Typer for command-line argument parsing
|
|
14
|
+
2. **Log Formatting** - `format_log_entry()` and `process_line()` handle JSON parsing and colorized output
|
|
15
|
+
3. **File Reading** - `read_last_n_lines()` efficiently reads from file end
|
|
16
|
+
4. **File Following** - Uses `watchdog` library to monitor file changes in real-time
|
|
17
|
+
5. **Multi-file Support** - Can merge logs from multiple files by timestamp
|
|
18
|
+
|
|
19
|
+
### Key Classes
|
|
20
|
+
|
|
21
|
+
- `LogLevel` - Enum for log level filtering (DEBUG, INFO, WARNING, ERROR, CRITICAL)
|
|
22
|
+
- `LogFileHandler` - Watchdog event handler for single file monitoring
|
|
23
|
+
- `MultiFileHandler` - Watchdog event handler for multiple file monitoring
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
- `typer` - CLI framework
|
|
28
|
+
- `aiofiles` - Async file I/O
|
|
29
|
+
- `watchdog` - File system monitoring
|
|
30
|
+
- `single-source` - Version from pyproject.toml
|
|
31
|
+
|
|
32
|
+
## Version Management
|
|
33
|
+
|
|
34
|
+
The version is single-sourced from `pyproject.toml` using the `single-source` library:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from single_source import get_version
|
|
38
|
+
__version__ = get_version(__name__, Path(__file__).parent)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Entry Point
|
|
42
|
+
|
|
43
|
+
The CLI entry point is defined in `pyproject.toml`:
|
|
44
|
+
|
|
45
|
+
```toml
|
|
46
|
+
[project.scripts]
|
|
47
|
+
tailjlogs = "tailjlogs:app"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Development Commands
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Install dependencies
|
|
54
|
+
uv sync
|
|
55
|
+
|
|
56
|
+
# Run the tool
|
|
57
|
+
uv run tailjlogs --help
|
|
58
|
+
|
|
59
|
+
# Run with a log file
|
|
60
|
+
uv run tailjlogs /path/to/logs.jsonl -f
|
|
61
|
+
|
|
62
|
+
# Build package
|
|
63
|
+
uv build
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Testing
|
|
67
|
+
|
|
68
|
+
Currently no test suite. When adding tests, create a `tests/` directory with pytest.
|
|
69
|
+
|
|
70
|
+
## Code Style
|
|
71
|
+
|
|
72
|
+
- Python 3.13+
|
|
73
|
+
- Type hints using `Annotated` for Typer options
|
|
74
|
+
- Async/await for file operations
|
|
75
|
+
- ANSI color codes for terminal output
|
tailjlogs-1.0.4/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Brian of London
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
tailjlogs-1.0.4/PKG-INFO
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tailjlogs
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Summary: Tail and follow JSONL log files with pretty formatting
|
|
5
|
+
Project-URL: Homepage, https://github.com/brianoflondon/tailjlogs
|
|
6
|
+
Project-URL: Repository, https://github.com/brianoflondon/tailjlogs
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/brianoflondon/tailjlogs/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/brianoflondon/tailjlogs/releases
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Python: >=3.13
|
|
11
|
+
Requires-Dist: aiofiles>=24.1.0
|
|
12
|
+
Requires-Dist: single-source>=0.4.0
|
|
13
|
+
Requires-Dist: typer>=0.15.0
|
|
14
|
+
Requires-Dist: watchdog>=6.0.0
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# TailJLogs
|
|
18
|
+
|
|
19
|
+
[](https://pypi.org/project/tailjlogs/)
|
|
20
|
+
[](https://github.com/brianoflondon/tailjlogs/actions/workflows/tests.yml)
|
|
21
|
+
|
|
22
|
+
A command line tool to tail and follow JSONL log files with pretty formatting.
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
- 📋 Display JSONL logs in a clean, readable format similar to `docker logs`
|
|
27
|
+
- 🔄 Follow mode (`-f`) for real-time log monitoring
|
|
28
|
+
- 🎨 Colorized output by log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
|
|
29
|
+
- 🔍 Filter by log level (`-l WARNING`)
|
|
30
|
+
- 🔎 Grep pattern matching (`-g "error|failed"`)
|
|
31
|
+
- 🚫 Exclude patterns (`-G "healthcheck"`)
|
|
32
|
+
- 📁 Directory support - merge multiple log files by timestamp
|
|
33
|
+
- ⚡ Async file reading for performance
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
### Standalone Installation (Recommended)
|
|
38
|
+
|
|
39
|
+
Install TailJLogs from PyPI (recommended):
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Using pip
|
|
43
|
+
pip install tailjlogs
|
|
44
|
+
|
|
45
|
+
# Install a specific version
|
|
46
|
+
pip install tailjlogs==1.0.1
|
|
47
|
+
|
|
48
|
+
# Using pipx (isolated CLI install)
|
|
49
|
+
pipx install tailjlogs
|
|
50
|
+
|
|
51
|
+
# Using uv
|
|
52
|
+
uv tool install tailjlogs
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
After installation, `tailjlogs` will be available in your PATH.
|
|
56
|
+
|
|
57
|
+
If you prefer to install from GitHub (for development or edge builds), use:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# From source (development)
|
|
61
|
+
git clone https://github.com/brianoflondon/tailjlogs.git
|
|
62
|
+
cd tailjlogs
|
|
63
|
+
uv sync
|
|
64
|
+
uv pip install -e .
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### From Source (for development)
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
git clone https://github.com/brianoflondon/tailjlogs.git
|
|
71
|
+
cd tailjlogs
|
|
72
|
+
uv sync
|
|
73
|
+
|
|
74
|
+
# Run directly
|
|
75
|
+
uv run tailjlogs --help
|
|
76
|
+
|
|
77
|
+
# Or install in editable mode
|
|
78
|
+
uv pip install -e .
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Updating
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Using uv
|
|
85
|
+
uv tool upgrade tailjlogs
|
|
86
|
+
|
|
87
|
+
# Using pipx
|
|
88
|
+
pipx upgrade tailjlogs
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Uninstalling
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Using uv
|
|
95
|
+
uv tool uninstall tailjlogs
|
|
96
|
+
|
|
97
|
+
# Using pipx
|
|
98
|
+
pipx uninstall tailjlogs
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Usage
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Show last 50 lines and follow
|
|
105
|
+
tailjlogs logs/app.jsonl -f
|
|
106
|
+
|
|
107
|
+
# Show last 100 lines with WARNING or higher
|
|
108
|
+
tailjlogs logs/app.jsonl -n 100 -l WARNING
|
|
109
|
+
|
|
110
|
+
# Filter by regex pattern and follow
|
|
111
|
+
tailjlogs logs/app.jsonl -f -g "error|failed"
|
|
112
|
+
|
|
113
|
+
# Exclude health check logs
|
|
114
|
+
tailjlogs logs/app.jsonl -f -G "healthcheck"
|
|
115
|
+
|
|
116
|
+
# Tail a directory (merges all .jsonl files by timestamp)
|
|
117
|
+
tailjlogs logs/ -n 100 -f
|
|
118
|
+
|
|
119
|
+
# Show version
|
|
120
|
+
tailjlogs --version
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Options
|
|
124
|
+
|
|
125
|
+
| Option | Short | Description |
|
|
126
|
+
| ---------------- | ----- | -------------------------------------------------------------------- |
|
|
127
|
+
| `--follow` | `-f` | Follow the log file for new entries (like tail -f) |
|
|
128
|
+
| `--tail` | `-n` | Number of lines to show from the end (default: 50) |
|
|
129
|
+
| `--level` | `-l` | Minimum log level to display (DEBUG, INFO, WARNING, ERROR, CRITICAL) |
|
|
130
|
+
| `--grep` | `-g` | Filter messages by regex pattern (include matches) |
|
|
131
|
+
| `--grep-exclude` | `-G` | Exclude messages matching regex pattern |
|
|
132
|
+
| `--no-color` | | Disable colored output |
|
|
133
|
+
| `--verbose` | `-v` | Use verbose output format |
|
|
134
|
+
| `--extras` | `-e` | Show extra fields in log entries |
|
|
135
|
+
| `--version` | `-V` | Show version and exit |
|
|
136
|
+
|
|
137
|
+
## Expected JSONL Format
|
|
138
|
+
|
|
139
|
+
TailJLogs expects log entries in JSONL format with the following fields:
|
|
140
|
+
|
|
141
|
+
```json
|
|
142
|
+
{
|
|
143
|
+
"timestamp": "2025-01-16T10:30:45.123456Z",
|
|
144
|
+
"level": "INFO",
|
|
145
|
+
"message": "User logged in",
|
|
146
|
+
"module": "auth",
|
|
147
|
+
"line": 42,
|
|
148
|
+
"logger": "app.auth",
|
|
149
|
+
"function": "login"
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Development
|
|
154
|
+
|
|
155
|
+
### Setup
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
git clone https://github.com/brianoflondon/tailjlogs.git
|
|
159
|
+
cd tailjlogs
|
|
160
|
+
uv sync
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Running Tests
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Run all tests
|
|
167
|
+
uv run pytest
|
|
168
|
+
|
|
169
|
+
# Run with verbose output
|
|
170
|
+
uv run pytest -v
|
|
171
|
+
|
|
172
|
+
# Run specific test file
|
|
173
|
+
uv run pytest tests/test_formatting.py
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
MIT
|