logger

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: Apache-2.0 Imports: 9 Imported by: 8

Documentation

Overview

Package logger provides a logging capability for toolhive for running locally as a CLI and in Kubernetes.

This is a thin shim over toolhive-core/logging that maintains backward compatibility with existing call sites. New code should inject *slog.Logger directly; use Get to obtain the underlying logger for injection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DPanic added in v0.2.10

func DPanic(msg string)

DPanic logs a message at error level using the singleton logger. Unlike zap's DPanic, this always logs at error level and never panics, since slog has no equivalent of development-only panic behavior.

func DPanicf added in v0.2.10

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

DPanicf logs a message at error level using the singleton logger.

func DPanicw added in v0.2.10

func DPanicw(msg string, keysAndValues ...any)

DPanicw logs a message at error level using the singleton logger with additional key-value pairs.

func Debug added in v0.0.33

func Debug(msg string)

Debug logs a message at debug level using the singleton logger.

func Debugf added in v0.0.33

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

Debugf logs a message at debug level using the singleton logger.

func Debugw added in v0.2.10

func Debugw(msg string, keysAndValues ...any)

Debugw logs a message at debug level using the singleton logger with additional key-value pairs.

func Error added in v0.0.33

func Error(msg string)

Error logs a message at error level using the singleton logger.

func Errorf added in v0.0.33

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

Errorf logs a message at error level using the singleton logger.

func Errorw added in v0.2.10

func Errorw(msg string, keysAndValues ...any)

Errorw logs a message at error level using the singleton logger with additional key-value pairs.

func Fatal added in v0.2.10

func Fatal(msg string)

Fatal logs a message at error level using the singleton logger and exits the program.

func Fatalf added in v0.2.10

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

Fatalf logs a message at error level using the singleton logger and exits the program.

func Fatalw added in v0.2.10

func Fatalw(msg string, keysAndValues ...any)

Fatalw logs a message at error level using the singleton logger with additional key-value pairs and exits the program.

func Get added in v0.10.0

func Get() *slog.Logger

Get returns the underlying *slog.Logger for injection into structs.

func Info added in v0.0.33

func Info(msg string)

Info logs a message at info level using the singleton logger.

func Infof added in v0.0.33

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

Infof logs a message at info level using the singleton logger.

func Infow added in v0.2.10

func Infow(msg string, keysAndValues ...any)

Infow logs a message at info level using the singleton logger with additional key-value pairs.

func Initialize

func Initialize()

Initialize creates and configures the appropriate logger. If the UNSTRUCTURED_LOGS env var is set to true, it will output plain text. Otherwise it will create a standard structured JSON logger.

func InitializeWithEnv added in v0.2.13

func InitializeWithEnv(envReader env.Reader)

InitializeWithEnv creates and configures the appropriate logger with a custom environment reader. This allows for dependency injection of environment variable access for testing.

func NewLogr added in v0.0.33

func NewLogr() logr.Logger

NewLogr returns a logr.Logger backed by the slog singleton.

func Panic added in v0.0.34

func Panic(msg string)

Panic logs a message at error level using the singleton logger and panics the program.

func Panicf added in v0.0.34

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

Panicf logs a message at error level using the singleton logger and panics the program.

func Panicw added in v0.2.10

func Panicw(msg string, keysAndValues ...any)

Panicw logs a message at error level using the singleton logger with additional key-value pairs and panics the program.

func Set added in v0.10.0

func Set(l *slog.Logger)

Set replaces the singleton logger. This is intended for tests that need to capture log output; production code should use Initialize instead.

func Warn added in v0.0.33

func Warn(msg string)

Warn logs a message at warning level using the singleton logger.

func Warnf added in v0.0.33

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

Warnf logs a message at warning level using the singleton logger.

func Warnw added in v0.2.10

func Warnw(msg string, keysAndValues ...any)

Warnw logs a message at warning level using the singleton logger with additional key-value pairs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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