Involved Source Files Package slogtime provides an alternative [slog.Logger] implementation that
allows using custom [time.Now] function for log records.
It also has a smaller API surface that requires using explicit [slog.Level],
[context.Context] and [slog.Attr]s.
Package-Level Type Names (only one, which is exported)
/* sort exporteds by: | */
Logger is an alternative implementation of [slog.Logger] that allows
customizing the time source for log records.
Unlike [slog.Logger], Logger does not provide convenience methods like
Info, Debug, Warn, or Error. Instead, all logging is done through the
Log method with explicit level, context, and attributes.handlerslog.Handlernowfunc() time.Time Enabled reports whether l emits log records at the given context and level. Handler returns the underlying [slog.Handler]. Log emits a log record with the given level, message, and attributes.
The record includes a source location obtained from the call stack. With returns a [Logger] that includes the given attributes in each output
operation. Arguments are converted to attributes as if by [Logger.Log]. WithGroup returns a [Logger] that starts a group. The keys of all attributes
added to the [Logger] will be qualified by the given name. WithTime returns a [Logger] that uses the given time function.
If now is nil, [time.Now] will be used. clone returns a copy of the Logger.
func New(h slog.Handler, now func() time.Time) *Logger
func (*Logger).With(attrs ...slog.Attr) *Logger
func (*Logger).WithGroup(name string) *Logger
func (*Logger).WithTime(now func() time.Time) *Logger
func (*Logger).clone() *Logger
Package-Level Functions (only one, which is exported)
New creates a new [Logger] that uses the given handler and time function.
If now is nil, [time.Now] will be used when logging.
The pages are generated with Goldsv0.7.6. (GOOS=linux GOARCH=amd64)