Documentation ¶
Index ¶
- Constants
- func NewHandlerSyncer(syncer zapcore.WriteSyncer, handler slog.Handler) slog.Handler
- func NewXHandlerWrapper(inner slog.Handler) xslog.Handler
- func NewZap(log *slog.Logger) *zap.Logger
- func NewZapCore(log *slog.Logger) zapcore.Core
- func ToAttrs(data map[string]any) []slog.Attr
- func ToLeveler(level string) slog.Leveler
- type ChannelConfig
- type Config
- type ConsoleHandler
- type HandlerOptions
- type HandlerSyncer
- type Log
- type Logger
- type Plugin
- type ZapCore
- func (c *ZapCore) Check(ent zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry
- func (c *ZapCore) Enabled(lvl zapcore.Level) bool
- func (c *ZapCore) Sync() error
- func (c *ZapCore) With(fields []zapcore.Field) zapcore.Core
- func (c *ZapCore) Write(ent zapcore.Entry, fields []zapcore.Field) error
Constants ¶
View Source
const PluginName = "log"
Variables ¶
This section is empty.
Functions ¶
func NewHandlerSyncer ¶
Types ¶
type ChannelConfig ¶
type ChannelConfig struct { // Dedicated channels per logger. By default logger allocated via named logger. Channels map[string]Config `mapstructure:"channels" json:"channels,omitempty" bson:"channels,omitempty"` }
ChannelConfig configures loggers per channel.
func NewChannelConfig ¶
func NewChannelConfig(cfg configwise.Configurer, key string) (c ChannelConfig, err error)
type Config ¶
type Config struct { // When AddSource is true, the handler adds a ("source", "file:line") // attribute to the output indicating the source code position of the log // statement. AddSource is false by default to skip the cost of computing // this information. AddSource bool `mapstructure:"add_source" json:"add_source,omitempty" bson:"add_source,omitempty"` // Level is the minimum enabled logging level. Level string `mapstructure:"level" json:"level,omitempty" bson:"level,omitempty"` // Encoding sets the logger's encoding. Init values are "json", "text" and "console" Encoding string `mapstructure:"encoding" json:"encoding,omitempty" bson:"encoding,omitempty"` // Output is a list of URLs or file paths to write logging output to. // See Open for details. OutputPaths []string `mapstructure:"output_paths" json:"output_paths,omitempty" bson:"output_paths,omitempty"` Attrs map[string]any `mapstructure:"attributes" json:"attrs,omitempty" bson:"attrs,omitempty"` }
func NewConfig ¶
func NewConfig(cfg configwise.Configurer, key string) (c Config, err error)
func (*Config) Opts ¶
func (cfg *Config) Opts() *HandlerOptions
type ConsoleHandler ¶
type ConsoleHandler struct {
// contains filtered or unexported fields
}
func NewConsoleHandler ¶
func NewConsoleHandler(w io.Writer, opts *slog.HandlerOptions, attrs ...slog.Attr) *ConsoleHandler
type HandlerOptions ¶
type HandlerOptions struct {
*slog.HandlerOptions
}
func (HandlerOptions) NewHandler ¶
type HandlerSyncer ¶
type HandlerSyncer interface {
Sync() error
}
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
func Load ¶
func Load(cfg configwise.Configurer) (*Log, error)
Click to show internal directories.
Click to hide internal directories.