Unified logging for the Hypr ecosystem. CLI tool, Rust library, C-ABI FFI, and optional Hyprland IPC event streaming.
# from source
./install.sh
# remote
curl -fsSL https://raw.githubusercontent.com/ryugen-io/hyprslog/main/install.sh | bashInstalls to ~/.local/bin/hypr/hyprslog. Config at ~/.config/hypr/hyprslog.conf.
hyprslog info INIT "Application started"
hyprslog myapp info NET "Connection established"
hyprslog log myapp error NET "Connection failed"
echo '{"level":"info","scope":"TEST","msg":"hello"}' | hyprslog json
hyprslog preset startup
hyprslog stats
hyprslog cleanup --dry-run
hyprslog cleanup --compress --older-than 7d --keep-last 5
hyprslog themes preview
hyprslog watch # stream Hyprland events
hyprslog watch --events openwindow,closewindow --min-level warn
hyprslog # interactive shelluse hyprslog::{Logger, Level};
let logger = Logger::builder()
.level(Level::Debug)
.terminal()
.colors(true)
.done()
.file()
.base_dir("~/.local/state/hyprslog/logs")
.done()
.json()
.path("~/.local/state/hyprslog/db/hyprslog.jsonl")
.done()
.build();
logger.info("MAIN", "Application started");
logger.warn("NET", "Connection <bold>timeout</bold>");
logger.error("NET", "Connection <red>failed</red>");#include "hyprslog.h"
HyprlogContext* ctx = hyprlog_init_simple();
hyprlog_info(ctx, "MAIN", "Hello from C");
hyprlog_free(ctx);Header: include/hyprslog.h. Link against libhyprlog.so / libhyprlog.a. See examples/cpp/ for a full CMake example.
TOML format at ~/.config/hypr/hyprslog.conf. Supports Hyprland-style source = "path" includes with cycle detection.
[general]
level = "info"
[terminal]
enabled = true
colors = true
icons = "nerdfont" # nerdfont | ascii | none
structure = "{tag} {scope} {msg}"
[file]
enabled = true
base_dir = "~/.local/state/hyprslog/logs"
[json]
enabled = false
path = "~/.local/state/hyprslog/db/hyprslog.jsonl"
[cleanup]
max_age_days = 30
max_total_size = "500M"
keep_last = 5
[hyprland]
enabled = true
scope = "HYPR"
ignore_events = ["mousemove"]
[tag]
transform = "uppercase"
alignment = "center"
width = 7
[scope]
transform = "uppercase"
width = 10
[highlight]
enabled = true
urls = true
paths = true
numbers = true
quotes = true
[colors]
accent = "#89b4fa"
success = "#a6e3a1"
[presets.startup]
level = "info"
scope = "INIT"
msg = "Application started"
app_name = "myapp"
[apps.myapp]
level = "debug"
[apps.myapp.terminal]
colors = true
icons = "ascii"Messages support inline styling with XML-like tags:
logger.info("MAIN", "<bold>Server</bold> listening on <cyan>:8080</cyan>");
logger.error("NET", "<red>Connection failed</red>: <dim>timeout after 30s</dim>");
Available tags: <bold>, <dim>, <italic>, <underline>, <red>, <green>, <yellow>, <cyan>, <blue>, <purple>, <pink>, <orange>, <white>, and custom colors from config.
Auto-highlighting detects URLs, file paths, numbers, and quoted strings without manual tagging.
Output template placeholders: {tag}, {icon}, {scope}, {msg}, {level}, {app}, {timestamp}.
Single crate, feature-gated modules:
src/
bin/hyprslog.rs CLI entry point
lib.rs Library entry point
error.rs Unified error type
logger/ Logger + builder pattern
output/ Terminal, File, JSON backends (trait Output)
config/ TOML config with source includes
fmt/ Formatting: color, style, tags, scope, icons, highlight, templates
level/ Log levels (Trace, Debug, Info, Warn, Error)
cleanup/ Age/size-based log cleanup with gzip compression
internal/ Internal hyprslog logger (OnceLock)
cli/ CLI commands (feature: cli)
shell/ Interactive REPL with themes (feature: cli)
hyprland/ Hyprland socket2 event listener (feature: hyprland)
ffi.rs C-ABI bindings (feature: ffi)
| Feature | Default | Description |
|---|---|---|
cli |
yes | CLI binary and interactive shell |
ffi |
C-ABI bindings (libhyprlog.so) |
|
hyprland |
Hyprland IPC event streaming |
Requires Rust edition 2024. Uses just as task runner.
just build # release build
just build-debug # debug build
just test # cargo-nextest (fallback: cargo test)
just fmt # cargo fmt
just lint # clippy -D warnings
just bench # criterion benchmarks
just fuzz # cargo-fuzz (all 6 targets, 30s each)
just docs # rustdoc
just pre-commit # fmt + lint + test
just clean # cargo clean
just size # binary size
just bloat # cargo-bloat
just audit # cargo-audit
just outdated # cargo-outdated
just coverage # tarpaulin coverage
just loc # lines of code
just tree # source treeDirect cargo:
cargo test --features hyprland # all tests with hyprland
cargo test --test config # single test file
cargo test --test config -- test_name # single test
cargo test --lib # unit tests only
cargo bench # criterion benchmarks145 tests across 26 integration test files and 3 unit test modules. Uses tempfile for filesystem tests.
3 criterion benchmark files: parsing, formatting, output. Reports at target/criterion/report/index.html.
6 fuzz targets via cargo-fuzz (requires nightly):
fuzz_color_hex- hex color parsingfuzz_config_sources- config source extractionfuzz_event_parse- Hyprland event parsingfuzz_format_template- template parsingfuzz_highlight- auto-highlight injectionfuzz_style_parse- inline style tag parsing
MIT