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 ¶
- func DPanic(msg string)
- func DPanicf(msg string, args ...any)
- func DPanicw(msg string, keysAndValues ...any)
- func Debug(msg string)
- func Debugf(msg string, args ...any)
- func Debugw(msg string, keysAndValues ...any)
- func Error(msg string)
- func Errorf(msg string, args ...any)
- func Errorw(msg string, keysAndValues ...any)
- func Fatal(msg string)
- func Fatalf(msg string, args ...any)
- func Fatalw(msg string, keysAndValues ...any)
- func Get() *slog.Logger
- func Info(msg string)
- func Infof(msg string, args ...any)
- func Infow(msg string, keysAndValues ...any)
- func Initialize()
- func InitializeWithEnv(envReader env.Reader)
- func NewLogr() logr.Logger
- func Panic(msg string)
- func Panicf(msg string, args ...any)
- func Panicw(msg string, keysAndValues ...any)
- func Set(l *slog.Logger)
- func Warn(msg string)
- func Warnf(msg string, args ...any)
- func Warnw(msg string, keysAndValues ...any)
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 DPanicw ¶ added in v0.2.10
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 Debugw ¶ added in v0.2.10
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 Errorw ¶ added in v0.2.10
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
Fatalf logs a message at error level using the singleton logger and exits the program.
func Fatalw ¶ added in v0.2.10
Fatalw logs a message at error level using the singleton logger with additional key-value pairs and exits the program.
func Info ¶ added in v0.0.33
func Info(msg string)
Info logs a message at info level using the singleton logger.
func Infow ¶ added in v0.2.10
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
InitializeWithEnv creates and configures the appropriate logger with a custom environment reader. This allows for dependency injection of environment variable access for testing.
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
Panicf logs a message at error level using the singleton logger and panics the program.
func Panicw ¶ added in v0.2.10
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
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.
Types ¶
This section is empty.