logwriter

command module
v0.0.0-...-9ee4103 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 15 Imported by: 0

README

logwriter

A Go-based log management utility that wraps command execution, captures output to log files, and automatically manages log retention based on time and disk space constraints.

Features

  • Wraps any command and captures stdout/stderr to dated log files
  • Automatic log rotation based on age or disk space
  • Flexible log naming patterns (flat or hierarchical)
  • Cron-based scheduled cleanup
  • Zero application changes required

Quick Start

Installation
go mod tidy
go build -o logwriter
Configuration

Create /etc/logging.json:

{
  "prefix": "myapp",
  "log_path": "/var/log/myapp",
  "log_pattern": "flat",
  "config_path": "/etc/myapp/config.json",
  "default_cron": "0 0 * * *",
  "time": {
    "enabled": true,
    "path": "logging.max_days",
    "cron_path": "logging.time_cron"
  },
  "space": {
    "enabled": true,
    "path": "logging.max_gb",
    "cron_path": "logging.space_cron"
  }
}
Usage
logwriter your-command --with-args

Documentation

For comprehensive documentation including configuration options, integration examples, and troubleshooting, see docs/DOCUMENTATION.md.

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL