logging

package
v0.0.0-...-e308f56 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package logging provides logging configuration and utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configure

func Configure(ctx context.Context, config Config) (*slog.Logger, context.Context)

Configure sets up logging with the given config and returns the logger and updated context.

func ContextWithLogger

func ContextWithLogger(ctx context.Context, logger *slog.Logger) context.Context

ContextWithLogger returns a new context with the given logger.

func FromContext

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

func GetLevel

func GetLevel() slog.Level

GetLevel returns the current global log level.

func SetLevel

func SetLevel(level slog.Level)

SetLevel sets the global log level at runtime.

Types

type Config

type Config struct {
	JSON  bool              `hcl:"json,optional" help:"Enable JSON logging."`
	Level slog.Level        `hcl:"level" help:"Set the logging level." default:"info"`
	Remap map[string]string `hcl:"remap,optional" help:"Remap field names from old to new (e.g., msg=message, time=timestamp)."`
}

Jump to

Keyboard shortcuts

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