Skip to content

Commit 1416247

Browse files
committed
docs: refactor documentation structure and add MIT license
Reorganize documentation to separate user and developer concerns: - README.md now focuses on end-users (installation, usage, features) - CONTRIBUTING.md contains all development information (architecture, performance, testing, dependencies, workflows) - Removed cargo commands from user-facing docs - Added MIT LICENSE file - Updated Cargo.toml with package metadata (license, description, repository, keywords, categories) - Fixed edition from 2024 to 2021 This makes the README cleaner and more accessible for users while keeping comprehensive development documentation in CONTRIBUTING.md.
1 parent 603ceed commit 1416247

File tree

4 files changed

+116
-91
lines changed

4 files changed

+116
-91
lines changed

CONTRIBUTING.md

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,51 @@ cargo test
2727

2828
# Run with a log file
2929
cargo run -- test.log
30+
31+
# Run in release mode with a log file
32+
cargo run --release -- test.log
33+
```
34+
35+
## Project Architecture
36+
3037
```
38+
src/
39+
├── main.rs # Entry point, CLI, and main event loop
40+
├── app.rs # Application state management
41+
├── reader/
42+
│ ├── mod.rs # LogReader trait
43+
│ └── file_reader.rs # Lazy file reader with line indexing
44+
├── filter/
45+
│ ├── mod.rs # Filter trait
46+
│ ├── engine.rs # Background filtering engine
47+
│ ├── regex_filter.rs # Regex filter implementation
48+
│ └── string_filter.rs# String matching filter
49+
├── ui/
50+
│ └── mod.rs # ratatui rendering logic
51+
└── watcher.rs # File watching with inotify
52+
```
53+
54+
For detailed architecture documentation, see `CLAUDE.md`.
55+
56+
## Performance Characteristics
57+
58+
The viewer is designed to handle large log files efficiently:
59+
- **Line indexing**: O(n) one-time indexing, then O(1) random access
60+
- **Viewport rendering**: Only renders visible lines
61+
- **Background filtering**: Non-blocking filter execution in separate thread
62+
- **Memory usage**: ~constant regardless of file size (only viewport buffer in RAM)
63+
- **Incremental filtering**: Only filters new log lines when file grows
64+
65+
## Dependencies
66+
67+
- **ratatui** - TUI framework
68+
- **crossterm** - Cross-platform terminal manipulation
69+
- **notify** - File system watching
70+
- **regex** - Regular expression support
71+
- **serde_json** - JSON parsing
72+
- **clap** - CLI argument parsing
73+
- **anyhow** - Error handling
74+
- **ansi-to-tui** - ANSI escape code parsing and color rendering
3175

3276
### Development Tools
3377

@@ -40,10 +84,41 @@ cargo fmt -- --check
4084

4185
# Format code
4286
cargo fmt
87+
```
88+
89+
## Testing
4390

44-
# Generate test logs
91+
### Test Log Files
92+
93+
The repository includes test log files and generators:
94+
- `test.log` - Plain text logs with various log levels (INFO, DEBUG, WARN, ERROR)
95+
- `generate_logs.sh` - Script to generate plain text logs continuously
96+
- `generate_colored_logs.sh` - Script to generate ANSI-colored logs continuously
97+
98+
### Testing Live Reload and Follow Mode
99+
100+
Test the file watching feature:
101+
102+
```bash
103+
# Terminal 1: Start generating logs
45104
./generate_logs.sh live_test.log
105+
106+
# Terminal 2: Watch the logs in real-time
107+
cargo run --release -- live_test.log
108+
```
109+
110+
Press `f` to enable follow mode and watch new lines scroll into view automatically.
111+
112+
### Testing with Colored Logs
113+
114+
Test ANSI color support:
115+
116+
```bash
117+
# Terminal 1: Generate colored logs
46118
./generate_colored_logs.sh live_test_colored.log
119+
120+
# Terminal 2: View the logs with full color rendering
121+
cargo run --release -- live_test_colored.log
47122
```
48123

49124
## Commit Convention

Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
[package]
22
name = "lazytail"
33
version = "0.1.0"
4-
edition = "2024"
4+
edition = "2021"
5+
authors = ["raaymax"]
6+
license = "MIT"
7+
description = "A terminal-based log viewer with filtering capabilities"
8+
repository = "https://github.com/raaymax/lazytail"
9+
keywords = ["log", "viewer", "tui", "terminal", "tail"]
10+
categories = ["command-line-utilities", "development-tools"]
511

612
[dependencies]
713
ratatui = "0.29"

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 raaymax
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.

README.md

Lines changed: 12 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,8 @@ A terminal-based log viewer with filtering capabilities, built with Rust and rat
3838
**General:**
3939
- `q` or `Ctrl+C` - Quit
4040

41-
## Architecture
42-
43-
```
44-
src/
45-
├── main.rs # Entry point, CLI, and main event loop
46-
├── app.rs # Application state management
47-
├── reader/
48-
│ ├── mod.rs # LogReader trait
49-
│ └── file_reader.rs # Lazy file reader with line indexing
50-
├── filter/
51-
│ ├── mod.rs # Filter trait
52-
│ ├── engine.rs # Background filtering engine
53-
│ ├── regex_filter.rs # Regex filter implementation
54-
│ └── string_filter.rs# String matching filter
55-
├── ui/
56-
│ └── mod.rs # ratatui rendering logic
57-
└── watcher.rs # File watching with inotify
58-
```
59-
6041
## Installation
6142

62-
### Download Pre-built Binaries
63-
6443
Download the latest release for your platform from the [Releases page](https://github.com/raaymax/lazytail/releases):
6544

6645
```bash
@@ -83,28 +62,14 @@ chmod +x lazytail
8362
sudo mv lazytail /usr/local/bin/
8463
```
8564

86-
### Build from Source
87-
88-
```bash
89-
git clone https://github.com/raaymax/lazytail.git
90-
cd lazytail
91-
cargo build --release
92-
sudo cp target/release/lazytail /usr/local/bin/
93-
```
65+
For building from source, see [CONTRIBUTING.md](CONTRIBUTING.md).
9466

9567
## Usage
9668

97-
Run the application with a log file:
69+
Run LazyTail with a log file:
9870

9971
```bash
100-
cargo run --release -- test.log
101-
```
102-
103-
Or build and run the binary:
104-
105-
```bash
106-
cargo build --release
107-
./target/release/lazytail test.log
72+
lazytail /path/to/your/logfile.log
10873
```
10974

11075
### Command Line Options
@@ -130,60 +95,25 @@ Options:
13095

13196
The filter searches through all lines in the background without blocking the UI, so even with large files the interface remains responsive.
13297

133-
### Testing Live Reload and Follow Mode
134-
135-
Test the file watching feature with the included log generator:
136-
137-
```bash
138-
# Terminal 1: Start generating logs
139-
./generate_logs.sh live_test.log
140-
141-
# Terminal 2: Watch the logs in real-time
142-
cargo run --release -- live_test.log
143-
```
98+
### Using Follow Mode
14499

145-
**Using Follow Mode:**
100+
**Follow Mode** allows you to automatically scroll to new log lines as they're written to the file (like `tail -f`):
146101
1. Press `f` to enable follow mode - the status bar will show "FOLLOW"
147102
2. New log lines will automatically scroll into view as they arrive
148103
3. Press `f` again to disable follow mode and manually navigate
149104
4. Any manual scroll action (↑/↓/PgUp/PgDn/g/G) automatically disables follow mode
150105

151-
New log lines will appear automatically as they're written to the file. File watching is enabled by default, but you can disable it with `--no-watch` if needed.
152-
153-
### Testing with Colored Logs
154-
155-
Test with ANSI-colored logs using the colored log generator:
106+
File watching is enabled by default, so new log lines will appear automatically as they're written to the file. You can disable it with `--no-watch` if needed.
156107

157-
```bash
158-
# Terminal 1: Generate colored logs
159-
./generate_colored_logs.sh live_test_colored.log
160-
161-
# Terminal 2: View the logs with full color rendering
162-
cargo run --release -- live_test_colored.log
163-
```
108+
### ANSI Color Support
164109

165-
The viewer parses ANSI escape codes and renders them in full color! Colored logs from other tools (like `docker logs`, `kubectl logs`, or application logs with color formatting) display beautifully:
110+
LazyTail parses ANSI escape codes and renders them in full color! Colored logs from other tools (like `docker logs`, `kubectl logs`, or application logs with color formatting) display beautifully:
166111
- **Green** for INFO
167112
- **Cyan** for DEBUG
168113
- **Yellow** for WARN
169114
- **Red** for ERROR
170115
- Plus all other ANSI colors and styles (bold, dim, etc.)
171116

172-
## Testing
173-
174-
Test log files are included:
175-
- `test.log` - Plain text logs with various log levels (INFO, DEBUG, WARN, ERROR)
176-
- `generate_logs.sh` - Script to generate plain text logs
177-
- `generate_colored_logs.sh` - Script to generate ANSI-colored logs
178-
179-
## Performance
180-
181-
The viewer is designed to handle large log files efficiently:
182-
- **Line indexing**: O(n) one-time indexing, then O(1) random access
183-
- **Viewport rendering**: Only renders visible lines
184-
- **Background filtering**: Non-blocking filter execution in separate thread
185-
- **Memory usage**: ~constant regardless of file size (only viewport buffer in RAM)
186-
187117
## Upcoming Features
188118

189119
- [x] File watching with auto-reload (inotify)
@@ -200,17 +130,6 @@ The viewer is designed to handle large log files efficiently:
200130
- [ ] Case-sensitive filter toggle
201131
- [ ] Bookmark lines
202132

203-
## Dependencies
204-
205-
- **ratatui** - TUI framework
206-
- **crossterm** - Cross-platform terminal manipulation
207-
- **notify** - File system watching
208-
- **regex** - Regular expression support
209-
- **serde_json** - JSON parsing
210-
- **clap** - CLI argument parsing
211-
- **anyhow** - Error handling
212-
- **ansi-to-tui** - ANSI escape code parsing and color rendering
213-
214133
## Contributing
215134

216135
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for:
@@ -219,3 +138,7 @@ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for:
219138
- CI/CD workflow documentation
220139
- Release process
221140
- Pull request guidelines
141+
142+
## License
143+
144+
LazyTail is licensed under the [MIT License](LICENSE).

0 commit comments

Comments
 (0)