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
Colorized Terminal OutputSeparate Log LevelsCustom Notice Level
LoggerTerminal Output

Custom Notice Level

The logger includes a custom `LevelNotice` log level designed for important operational messages that should remain highly visible in terminal output.

LevelNotice is positioned between INFO and WARN and is intended for events such as:

  • application startup
  • graceful shutdown
  • deployment events
  • configuration loading
  • maintenance notifications
  • important business operations

Example usage:

package main

import (
	"log/slog"

	"github.com/netlifeguru/logger"
)

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

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

	defer closer.Close()

	logger.Notice("server started")
	logger.Notice("configuration loaded")
}

Example terminal output:

2026-05-11 12:45:43 server started
2026-05-11 12:45:43 configuration loaded

LevelNotice is useful when standard informational logs are too noisy but warnings or errors would incorrectly imply a problem state.

Context-aware variants are also supported:

logger.NoticeContext(ctx, "background worker initialized")

Full example:

package main

import (
	"context"
	"log/slog"

	"github.com/netlifeguru/logger"
)

func main() {
	closer, err := logger.Init(logger.Config{
		Dir:            "./logs",
		TerminalOutput: true,
	})
	if err != nil {
		slog.Error(err.Error())
	}
	defer closer.Close()

	ctx := context.Background()

	logger.NoticeContext(ctx, "important event", "order_id", 1)
}

Internally, the notice level integrates directly with the logger’s structured logging pipeline and behaves like any other slog level.

Separate Log Levels

The logger supports independent log levels for file output and terminal output.

Structured JSON Logging

The logger writes structured log entries as JSON, making logs easy to parse, search, and process in production environments.