Files
..
2026-01-13 12:55:30 +11:00
2026-02-25 22:06:27 +11:00
2026-02-25 22:06:27 +11:00
2026-02-25 22:06:27 +11:00
2026-02-25 22:06:27 +11:00
2026-01-13 12:55:30 +11:00
2026-01-13 12:55:30 +11:00
2026-01-13 13:31:15 +11:00
2026-01-13 12:55:30 +11:00
2026-01-13 12:55:30 +11:00
2026-01-13 12:55:30 +11:00
2026-01-13 12:55:30 +11:00

HLog - v0.10.4

A structured logging package for Go built on top of zerolog. HLog provides simple configuration via environment variables, flexible output options, and automatic log file management.

Features

  • Multiple output modes: console, file, or both simultaneously
  • Configurable log levels: trace, debug, info, warn, error, fatal, panic
  • Environment variable-based configuration with ConfigFromEnv
  • Automatic log file management with append or overwrite modes
  • Built on zerolog for high performance and structured logging
  • Error stack trace support via pkg/errors integration
  • Unix timestamp format
  • Console-friendly output formatting
  • Multi-writer support for simultaneous console and file output

Installation

go get git.haelnorr.com/h/golib/hlog

Quick Start

package main

import (
	"log"
	"os"

	"git.haelnorr.com/h/golib/hlog"
)

func main() {
	// Load configuration from environment variables
	cfg, err := hlog.ConfigFromEnv()
	if err != nil {
		log.Fatal(err)
	}

	// Create a new logger
	logger, err := hlog.NewLogger(cfg, os.Stdout)
	if err != nil {
		log.Fatal(err)
	}
	defer logger.CloseLogFile()

	// Start logging
	logger.Info().Msg("Application started")
	logger.Debug().Str("user", "john").Msg("User logged in")
	logger.Error().Err(err).Msg("Something went wrong")
}

Documentation

For detailed documentation, see the HLog Wiki.

Additional API documentation is available at GoDoc.

License

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

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  • env - Environment variable helper used by hlog for configuration
  • zerolog - The underlying logging library