Discover Packages
github.com/mickamy/adms
internal
logger
package
Version:
v0.0.1
Opens a new window with list of versions in this module.
Published: Jun 30, 2026
License: MIT
Opens a new window with license information.
Imports: 5
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Jump to ...
Documentation
Overview
Index
Constants
Variables
Functions
Capture(t, w)
Debug(ctx, msg, args)
Error(ctx, msg, args)
Info(ctx, msg, args)
Init(w, level)
New(w, level)
Warn(ctx, msg, args)
Types
Source Files
Documentation
Documentation
¶
Package logger wraps log/slog so other packages can log without
importing slog directly.
func Capture(t TestingT, w io.Writer)
func Debug(ctx context.Context, msg string, args ...any)
func Error(ctx context.Context, msg string, args ...any)
func Info(ctx context.Context, msg string, args ...any)
func Init(w io.Writer, level string)
func New(w io.Writer, level string) *slog.Logger
func Warn(ctx context.Context, msg string, args ...any)
type TestingT
Capture swaps the default logger for the duration of the test. The swap
is global, so tests calling Capture must not use t.Parallel().
Init installs a logger built from New as slog's process-wide default.
New constructs a JSON logger at the named level. Unknown levels fall
back to info; config.Load already rejects anything outside the set, so
this branch only triggers if a caller bypasses config validation.
type TestingT interface {
Helper()
Cleanup(fn func())
}
TestingT is the subset of *testing.T that Capture needs, declared here
so production builds do not depend on the testing package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.