slog

package
v0.0.0-...-081568e Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package slog implements a structured logger. This logger is based on zerolog.

Index

Constants

This section is empty.

Variables

View Source
var Global = zerolog.New(zerolog.NewConsoleWriter(func(w *zerolog.ConsoleWriter) {
	w.FormatTimestamp = func(i interface{}) string {
		return i.(string)
	}
})).With().Timestamp().Logger().Level(zerolog.InfoLevel)

Global is the global logger.

Functions

func Debug

func Debug() *zerolog.Event

Debug logs a message at the debug level.

func Error

func Error() *zerolog.Event

Error logs a message at the error level.

func FromContext

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

FromContext returns the logger stored in ctx. If no logger is stored in ctx, it returns a disabled logger.

func Info

func Info() *zerolog.Event

Info logs a message at the info level.

func Warn

func Warn() *zerolog.Event

Warn logs a message at the warn level.

func WithContext

func WithContext(ctx context.Context) context.Context

WithContext creates a child logger with the field added to its context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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