NetLife Guru

Open source Go packages for fast, maintainable web systems. Built with a documentation-first approach.

Product
OverviewGolang packagesNews
Documentation
DocumentationGo LoggerGo RouterGo DB Form
Company
OverviewContactNewsGitHub
Community / Support
Supportinfo@netlife.guru
© 2026 NetLife Guru. All rights reserved.
GitHubinfo@netlife.guru
NetLife GuruNetLife GuruNetLife Guru
NetLife GuruNetLife GuruNetLife Guru
OverviewDocumentationNewsSupportContact

Golang packages

Logger Introduction
Logger

Logger Introduction

High-performance structured logger for Go built on top of log/slog.

Focused on minimal allocations, high performance, and simple file rotation while staying compatible with the Go standard logging ecosystem.

Use logger to combine colorized console output, JSON logging, file rotation, and daily log archiving through a clean slog-compatible API.

Features

  • Standard Compatible: Built directly on top of Go’s standard log/slog package
  • Colorized Terminal Output: Human-readable colored logs for local development
  • Structured JSON Logging: Machine-friendly JSON logs for production environments
  • Automatic Log Directory: Creates the default log directory automatically
  • File Rotation: Daily and size-based log rotation support
  • Automatic Cleanup: Removes old archived log files automatically
  • Daily Log Naming: Generates files such as 2026-05-11-0001.log
  • Separate Log Levels: Independent minimum levels for terminal and file output
  • Custom Notice Level: Includes LevelNotice support for important console-visible messages
  • Context Logging: Supports InfoContext, WarnContext, and ErrorContext
  • Structured Chaining: Reusable structured loggers with logger.With(...)
  • Source Tracking: Optional source file and line number logging
  • Thread-Safe Design: Safe for concurrent workloads and server environments
  • Optimized File Writer: High-throughput logging with reduced allocation overhead
  • Graceful Shutdown: Safe logger shutdown through the returned Closer

Requirements

This package requires Go 1.22 or newer.

It is designed for modern Go projects and may use language and standard library features introduced in recent Go versions.

  • Go: 1.22 or newer
  • Dependencies: Standard library only
  • Features used: Generics, concurrency primitives

Installation

Install the logger package into your Go project.

On this page

FeaturesRequirements