Skip to main content

A terminal log viewer with search and styling

Project description

dalog - Terminal Log Viewer

Version Python Version License

dalog is a terminal-based log viewing application built with Python and Textual. It provides advanced features for viewing, searching, and analyzing log files with a modern, keyboard-driven interface optimized for developer workflows.

✨ Features

  • 🔍 Live Search: Real-time filtering
  • 🎨 Smart Styling: Pattern-based syntax highlighting with regex support
  • 🎭 Theme Support: Choose from built-in Textual themes via CLI
  • ⌨️ Vim Keybindings: Full vim-style navigation with customizable keybindings
  • 🔄 Live Reload: Automatically update when log files change (like tail -f)
  • 🚫 Exclusion System: Filter out unwanted log entries with persistent patterns and regex
  • 📋 Visual Mode: Vi-style visual line selection with clipboard support
  • 🎯 HTML Rendering: Render HTML tags in logs (configurable tags)
  • ⚙️ Highly Configurable: Extensive configuration options via TOML files

📦 Installatio

Via pip (recommended)

pip install dalog

Development Installation

# Clone the repository
git clone https://github.com/team/dalog.git
cd dalog

# Install in development mode
pip install -e .

# Or with development dependencies
pip install -e ".[dev]"

NixOS Users

# Enter the development environment
nix-shell

# Install in development mode
pip install -e .

🚀 Quick Start

Basic Usage

# View a single log file
dalog application.log

# View multiple log files (opens the first file)
dalog app.log error.log debug.log

# Start with search pre-filled
dalog --search ERROR application.log

# Load only last 1000 lines
dalog --tail 1000 large-application.log

# Use custom configuration
dalog --config ~/.config/dalog/custom.toml app.log

# Use a specific Textual theme
dalog --theme nord app.log
dalog --theme gruvbox error.log
dalog --theme tokyo-night system.log

Default Keybindings

Key Action
/ Open search
ESC Close search/cancel/exit visual mode
j/k Navigate down/up
h/l Navigate left/right
g/G Go to top/bottom
Ctrl+u/Ctrl+d Page up/down
V Enter visual line mode (vi-style selection)
v Start selection at cursor (in visual mode)
y Yank/copy selected lines to clipboard (in visual mode)
r Reload file
L Toggle live reload
w Toggle text wrapping
e Manage exclusions
q Quit

Visual Mode

DaLog supports vi-style visual line selection:

  1. Press V to enter visual line mode
  2. Use j/k to navigate to the desired starting line (cursor shown with underline)
  3. Press v to start selection from the current cursor position
  4. Use j/k to extend the selection up/down
  5. Press y to yank (copy) selected lines to clipboard
  6. Press ESC to exit visual mode without copying

⚙️ Configuration

DaLog looks for configuration files in the following order:

  1. Command-line specified: --config path/to/config.toml
  2. $XDG_CONFIG_HOME/dalog/config.toml
  3. ~/.config/dalog/config.toml
  4. ~/.dalog.toml
  5. ./config.toml (current directory)

Example Configuration

[app]
default_tail_lines = 1000
live_reload = true
case_sensitive_search = false
vim_mode = true

[keybindings]
search = "/"
reload = "r"
toggle_live_reload = "L"
toggle_wrap = "w"
quit = "q"
show_exclusions = "e"
scroll_down = "j"
scroll_up = "k"
scroll_left = "h"
scroll_right = "l"
scroll_home = "g"
scroll_end = "G"

[display]
show_line_numbers = true
wrap_lines = false
max_line_length = 1000
visual_mode_bg = "white"  # Background color for visual mode selection

[styling.patterns]
error = { pattern = "(?i)error", background = "red", color = "white" }
warning = { pattern = "(?i)warning", background = "yellow", color = "black", bold = true }
info = { pattern = "(?i)info", color = "blue" }

[styling.timestamps]
iso_datetime = { pattern = "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}", color = "cyan" }

[html]
# Configure which HTML tags to render in logs
enabled_tags = ["b", "i", "em", "strong", "span", "code", "pre"]
strip_unknown_tags = true

[exclusions]
patterns = ["DEBUG:", "TRACE:"]
regex = true
case_sensitive = false

🎨 Styling System

DaLog supports powerful regex-based styling patterns:

[styling.custom]
# Highlight IP addresses
ip_address = { pattern = "\\b(?:[0-9]{1,3}\\.){3}[0-9]{1,3}\\b", color = "magenta" }

# Highlight URLs
url = { pattern = "https?://[\\w\\.-]+", color = "blue", underline = true }

# Highlight email addresses
email = { pattern = "\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b", color = "cyan" }

# Custom application-specific patterns
user_id = { pattern = "user_id=\\d+", color = "green", bold = true }

🛠️ Development

Setting up the development environment

# Clone the repository
git clone https://github.com/team/dalog.git
cd dalog

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run linting
black src/
mypy src/
pylint src/

Project Structure

dalog/
├── src/dalog/          # Main package
│   ├── app.py          # Textual application
│   ├── cli.py          # Click CLI interface
│   ├── config/         # Configuration management
│   ├── core/           # Core functionality
│   ├── widgets/        # Custom Textual widgets
│   └── styles/         # CSS styles
├── tests/              # Test suite
├── docs/               # Documentation
└── pyproject.toml      # Project configuration

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Built with Textual - an amazing TUI framework
  • Inspired by traditional Unix tools like tail, less, and grep
  • Thanks to all contributors and users

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dalog-0.1.0.tar.gz (32.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dalog-0.1.0-py3-none-any.whl (34.8 kB view details)

Uploaded Python 3

File details

Details for the file dalog-0.1.0.tar.gz.

File metadata

  • Download URL: dalog-0.1.0.tar.gz
  • Upload date:
  • Size: 32.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dalog-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e4a2947e1b0569d6b3efcbdf1dde1ee030a8e8d911f387f8eafc8167dde0f6a8
MD5 a04b05ba5666e8dae974d3cdf4d27420
BLAKE2b-256 0c15f517ec25f924c3a7eb3db815bbc3e4b791450b699aaeae179c31e6705665

See more details on using hashes here.

File details

Details for the file dalog-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dalog-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 34.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dalog-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2803f7499e76acff36fab2d3f428d5634262243344c92f3950673e8276ef404b
MD5 17e680be5f101852a28dc2239d9d69c6
BLAKE2b-256 3dd8906798e126cce99a572fe3e40b20b15b6d0b04c49e7dbcc8a0d75f9053ef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page