log

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package log contains functions used internally for logging to a default logger implementing slog.Logger. The default logger can be set using [logger.SetDefault].

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Default added in v0.7.0

func Default() *slog.Logger

Default returns the default logger. This method is guaranteed to always return a value, even if the default has explicitly beed set to nil. If no default has been configured, or overriden by a nil value, the logger will discard all logged messages.

func ErrAttr added in v0.7.0

func ErrAttr(err error) slog.Attr

ErrAttr creates a log record attribute representing an error.

If the error originates from V8, the relevant JavaScript location and stack trace are included in the log record.

func SetDefault

func SetDefault(logger *slog.Logger)

Set a default slog/Logger instance to use in contexts where a specific logger has not been set. If no default logger is set, the default will discard all log messages.

Types

type LogSource added in v0.5.1

type LogSource interface{ Logger() *slog.Logger }

type Logger added in v0.5.1

type Logger = *slog.Logger

type LoggerLogSource added in v0.5.1

type LoggerLogSource struct{ L *slog.Logger }

func (LoggerLogSource) Logger added in v0.5.1

func (s LoggerLogSource) Logger() Logger

Jump to

Keyboard shortcuts

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