log

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package log provides a lightweight, structured logging interface for the lifecycle library. It is built on top of the standard library's log/slog package, ensuring idiomatic and efficient logging without external dependencies.

The package supports global logger configuration, allowing consumers of the library to inject their own slog.Logger instance to maintain consistency across their application.

Usage:

import "github.com/aretw0/lifecycle/pkg/log"

// Set a custom logger (e.g., JSON output)
log.SetLogger(slog.New(slog.NewJSONHandler(os.Stdout, nil)))

// Standard logging calls
log.Info("process started", "pid", 1234)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, args ...any)

Debug logs a message at LevelDebug.

func Error

func Error(msg string, args ...any)

Error logs a message at LevelError.

func GetLogger

func GetLogger() *slog.Logger

GetLogger returns the current global logger.

func Info

func Info(msg string, args ...any)

Info logs a message at LevelInfo.

func SetLogger

func SetLogger(l *slog.Logger)

SetLogger overrides the global logger used by the library.

func Warn

func Warn(msg string, args ...any)

Warn logs a message at LevelWarn.

func WithContext

func WithContext(ctx context.Context) *slog.Logger

WithContext returns the logger with context.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL