Documentation
¶
Overview ¶
Package logger adapts go-partial diagnostic events to log/slog.
Index ¶
Constants ¶
View Source
const (
// EventTemplateLog identifies diagnostic events emitted from templates.
EventTemplateLog = "ext.logger.template"
)
Variables ¶
This section is empty.
Functions ¶
func Logger ¶
func Logger(ctx *partial.RenderContext, message string, pairs ...any) string
Logger emits an info-level diagnostic event from template code.
go-doc:sig func(message string, pairs ...any) string
func Sink ¶
Sink returns an event sink that writes diagnostic events to slog, those of level warn and above unless options say otherwise. A nil log writes to slog.Default() as it is when each event is written, so a default set later is used.
func Stage ¶
func Stage() partial.RenderStage
Stage gives templates the request-scoped logger helper. It is made only for the templates that call it.
Types ¶
type Option ¶
type Option func(*config)
Option configures a logger sink.
func WithLevels ¶ added in v0.15.0
func WithLevels(levels ...partial.EventLevel) Option
WithLevels writes only events of the given levels, whatever the minimum level.
func WithMinLevel ¶
func WithMinLevel(level partial.EventLevel) Option
WithMinLevel ignores events below level.
Click to show internal directories.
Click to hide internal directories.