Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterContextEnricher ¶
func RegisterContextEnricher(fn ContextEnricher)
RegisterContextEnricher sets the global context enricher used by all loggers. Typically called from an init() in the package that owns PluginContext.
func SetDefault ¶
func SetDefault(l Logger)
Types ¶
type Backend ¶
type Backend interface {
Write(ctx context.Context, record Record) error
Sync(ctx context.Context) error
}
Backend emits log records to a concrete logging implementation.
type ContextEnricher ¶
ContextEnricher extracts structured fields from a context. Registered via RegisterContextEnricher to break import cycles.
type HCLBackend ¶
type HCLBackend struct {
// contains filtered or unexported fields
}
HCLBackend emits records to an hclog logger.
func NewDefaultHCLBackend ¶
func NewDefaultHCLBackend(name string, level Level) *HCLBackend
func NewHCLBackend ¶
func NewHCLBackend(logger hclog.Logger) *HCLBackend
func (*HCLBackend) Named ¶
func (b *HCLBackend) Named(name string) *HCLBackend
func (*HCLBackend) SetLevel ¶
func (b *HCLBackend) SetLevel(level Level)
type LevelController ¶
type LevelController struct {
// contains filtered or unexported fields
}
LevelController manages the effective log level at runtime.
func NewLevelController ¶
func NewLevelController(initial Level) *LevelController
func (*LevelController) Enabled ¶
func (c *LevelController) Enabled(level Level) bool
func (*LevelController) Level ¶
func (c *LevelController) Level() Level
func (*LevelController) Set ¶
func (c *LevelController) Set(level Level)
type Logger ¶
type Logger interface {
Named(name string) Logger
With(fields ...Field) Logger
Enabled(ctx context.Context, level Level) bool
Log(ctx context.Context, level Level, msg string, fields ...Field)
Trace(ctx context.Context, msg string, fields ...Field)
Debug(ctx context.Context, msg string, fields ...Field)
Info(ctx context.Context, msg string, fields ...Field)
Warn(ctx context.Context, msg string, fields ...Field)
Error(ctx context.Context, msg string, fields ...Field)
Fatal(ctx context.Context, msg string, fields ...Field)
Tracew(ctx context.Context, msg string, kv ...any)
Debugw(ctx context.Context, msg string, kv ...any)
Infow(ctx context.Context, msg string, kv ...any)
Warnw(ctx context.Context, msg string, kv ...any)
Errorw(ctx context.Context, msg string, kv ...any)
Fatalw(ctx context.Context, msg string, kv ...any)
Sync(ctx context.Context) error
}
Logger is the SDK-wide logging interface for plugin runtime logs.
type MultiSink ¶
type MultiSink struct {
// contains filtered or unexported fields
}
MultiSink fans out writes to multiple sinks.
func NewMultiSink ¶
type SinkBackend ¶
type SinkBackend struct {
// contains filtered or unexported fields
}
SinkBackend adapts a Sink to Backend.
func NewSinkBackend ¶
func NewSinkBackend(sink Sink) *SinkBackend
Click to show internal directories.
Click to hide internal directories.