log

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 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 Debug

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

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 Error

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

func Info

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

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.

func Warn

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

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