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
Standard CompatibleContext LoggingStructured ChainingSource Tracking
LoggerStructured Logging

Source Tracking

The logger can include source file and line information in log entries.

Source tracking is enabled with the AddSource configuration option and is useful during development, debugging, and troubleshooting production issues where the exact log origin matters.

Example configuration:

package main

import (
	"log/slog"

	"github.com/netlifeguru/logger"
)

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

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

	defer closer.Close()

	slog.Info("source tracking enabled")
}

Example file output:

{
  "time": "2026-05-11T12:53:20.834553+02:00",
  "level": "INFO",
  "source": {
    "function": "main.main",
    "file": "/examples/test/main.go",
    "line": 20
  },
  "msg": "source tracking enabled"
}

Source tracking helps with:

  • locating where a log entry was created
  • debugging complex application flows
  • tracing errors back to specific files
  • improving development visibility

Because source tracking requires runtime caller information, it may add a small amount of overhead and is usually enabled selectively when needed.

Structured Chaining

The logger supports reusable structured loggers through `logger.With(...)` and the standard `slog` attribute system.

Thread Safe Design

The logger is designed for concurrent use and can be safely shared across goroutines.