loglens-cli
Version:
A powerfull cli tool to analyze and filter log files smartly
82 lines (53 loc) โข 1.97 kB
Markdown
````markdown
# ๐ loglens-cli
**loglens-cli** is a powerful CLI tool designed for developers and DevOps engineers to quickly filter, inspect, and analyze log files. Whether you're debugging an issue or summarizing errors across days of logs, `loglens-cli` helps you extract just what you need โ fast.
## โจ Features
- ๐ Filter logs by log level (`error`, `warn`, `info`, `debug`)
- โฑ๏ธ Filter logs between specific date/time ranges
- ๐จ Colorized output for better readability
- ๐ Supports line-by-line JSON logs and fallback for raw logs
- ๐ก Easy-to-use CLI with helpful options
## ๐ฆ Installation
```bash
npm install -g loglens-cli
````
## ๐ Usage
```bash
loglens --file ./your-log-file.log [options]
```
### ๐ Options
| Option | Alias | Description |
| --------- | ----- | ----------------------------------------------------- |
| `--file` | `-f` | Path to your log file (required) |
| `--level` | `-l` | Filter by log level: `error`, `warn`, `info`, `debug` |
| `--from` | | Start timestamp (ISO format): `"2025-07-27T10:00:00"` |
| `--to` | | End timestamp (ISO format) |
### โ
Example Commands
```bash
loglens -f logs/app.log
loglens -f logs/app.log -l error
loglens -f logs/app.log --from "2025-07-27T00:00:00" --to "2025-07-28T00:00:00"
```
## ๐งช Sample Log Format
```json
{"timestamp":"2025-07-29T10:45:30","level":"info","message":"User logged in"}
{"timestamp":"2025-07-29T10:46:00","level":"error","message":"Failed to connect to DB"}
```
## ๐ ๏ธ Development
Clone this repo and run locally:
```bash
git clone https://github.com/ansh-2004/loglens-cli.git
cd loglens
npm link
```
Now you can run `loglens-cli` globally during development.
## ๐ License
MIT License
````