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
InstallationQuick StartConfiguration
LoggerGetting Started

Quick Start

The example below initializes the logger as a lightweight extension over Go’s standard log/slog package with colorized terminal output enabled.

package main

import (
	"log/slog"

	"github.com/netlifeguru/logger"
)

func main() {
	closer, err := logger.Init(logger.Config{
		TerminalOutput: true,
	})

	if err != nil {
		slog.Error(err.Error())
	}

	defer closer.Close()

	slog.Info("hello world")
}

Run:

go mod init example
go get github.com/netlifeguru/logger
go run main.go

During initialization, the logger automatically creates a log directory and writes structured JSON log files using daily log rotation.

Example log file:

log/2026-05-11-0001.log

Example log entry:

{
  "time": "2026-05-11T10:47:36.067863+02:00",
  "level": "INFO",
  "msg": "hello world"
}

Default log fields:

  • time - log timestamp
  • level - log severity level
  • msg - log message

Installation

Install the logger package into your Go project.

Configuration

The logger is configured using the `Config` struct.

On this page

Example log entry: