Documentation
¶
Index ¶
- type SlogCore
- func (c *SlogCore) Check(e zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry
- func (c *SlogCore) Enabled(l zapcore.Level) bool
- func (c *SlogCore) Sync() error
- func (c *SlogCore) With(fields []zapcore.Field) zapcore.Core
- func (c *SlogCore) Write(e zapcore.Entry, fields []zapcore.Field) error
- type SlogCoreOptions
- type ZapHandler
- type ZapHandlerOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SlogCore ¶
type SlogCore struct {
// contains filtered or unexported fields
}
func NewSlogCore ¶
func NewSlogCore(h slog.Handler, opts *SlogCoreOptions) *SlogCore
func (*SlogCore) Check ¶
func (c *SlogCore) Check(e zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry
type SlogCoreOptions ¶
type SlogCoreOptions struct {
// LoggerNameKey adds an attribute to slog.Records containing the zap logger name.
// If LoggerNameKey is empty, or the zap logger name is empty, then no attribute is added.
LoggerNameKey string
}
type ZapHandler ¶
type ZapHandler struct {
// contains filtered or unexported fields
}
func NewZapHandler ¶
func NewZapHandler(core zapcore.Core, opts *ZapHandlerOptions) *ZapHandler
type ZapHandlerOptions ¶
type ZapHandlerOptions struct {
// AddSource adds a source field to the zap log entry.
AddSource bool
// ReplaceAttr allows for customizing the attributes of the slog.Record before they are written to the zap log entry.
// For more information. see slog.HandlerOptions.ReplaceAttr.
ReplaceAttr func(groups []string, a slog.Attr) slog.Attr
// LoggerNameKey will search the slog.Record for an attribute with this key. If found, the zap
// entry's logger name will be set to the value of that attribute, and the attribute will be elided
// from the zap entry's fields.
LoggerNameKey string
}
Click to show internal directories.
Click to hide internal directories.