Documentation
¶
Index ¶
- Constants
- func ClearDebugToggleSignal()
- func ConfigFromEnv() *cfgapi.Config
- func Configure(config *cfgapi.Config) error
- func Debugging(source string) bool
- func EnableDebug(source string) bool
- func Flush()
- func GetOtelHandler() (slog.Handler, uint32)
- func SetOtelHandler(h slog.Handler) slog.Handler
- func SetOutput(w io.Writer) io.Writer
- func SetStdLogger(source string)
- func SetupDebugToggleSignal(sig os.Signal)
- type Attr
- type Handler
- func (h *Handler) Enabled(_ context.Context, lvl Level) bool
- func (h *Handler) FormatAttrs(buf *bytes.Buffer, r *slog.Record)
- func (h *Handler) FormatMessage(buf *bytes.Buffer, r *slog.Record)
- func (h *Handler) Handle(ctx context.Context, r slog.Record) error
- func (h *Handler) LegacyFormatMessage(buf *bytes.Buffer, r *slog.Record)
- func (h *Handler) WithAttrs(attrs []Attr) slog.Handler
- func (h *Handler) WithGroup(name string) slog.Handler
- func (h *Handler) WriteAttr(buf *bytes.Buffer, prefix string, a Attr)
- type Level
- type Logger
- type OtelHandler
- func (o *OtelHandler) Enabled(ctx context.Context, level slog.Level) (enabled bool)
- func (o *OtelHandler) GetHandler() slog.Handler
- func (o *OtelHandler) Handle(ctx context.Context, r slog.Record) error
- func (o *OtelHandler) NewChildHandlerWithAttrs(attrs []Attr) *OtelHandler
- func (o *OtelHandler) NewChildHandlerWithGroup(group string) *OtelHandler
- func (o *OtelHandler) WithAttrs(attrs []Attr) slog.Handler
- func (o *OtelHandler) WithGroup(name string) slog.Handler
Constants ¶
View Source
const ( DebugEnvVar = "LOGGER_DEBUG" LogSourceEnvVar = "LOGGER_LOG_SOURCE" LogSkipHdrsEnvVar = "LOGGER_SKIP_HEADERS" )
View Source
const ( LevelDebug = slog.LevelDebug LevelInfo = slog.LevelInfo LevelWarn = slog.LevelWarn LevelError = slog.LevelError LevelFatal = slog.LevelError + 4 LevelPanic = slog.LevelError + 8 )
Variables ¶
This section is empty.
Functions ¶
func ClearDebugToggleSignal ¶
func ClearDebugToggleSignal()
func ConfigFromEnv ¶ added in v0.13.0
func EnableDebug ¶
func GetOtelHandler ¶ added in v0.13.0
func SetStdLogger ¶
func SetStdLogger(source string)
func SetupDebugToggleSignal ¶
Types ¶
type Handler ¶ added in v0.13.0
func NewHandler ¶ added in v0.13.0
func (*Handler) FormatAttrs ¶ added in v0.13.0
func (*Handler) FormatMessage ¶ added in v0.13.0
func (*Handler) LegacyFormatMessage ¶ added in v0.13.0
type Logger ¶
type Logger interface {
Log(lvl Level, msg string, attrs ...Attr)
Debug(msg string, attrs ...Attr)
Info(msg string, attrs ...Attr)
Warn(msg string, attrs ...Attr)
Error(msg string, attrs ...Attr)
Fatal(msg string, attrs ...Attr)
Panic(msg string, attrs ...Attr)
Debugf(format string, args ...any)
Infof(format string, args ...any)
Warnf(format string, args ...any)
Errorf(format string, args ...any)
Fatalf(format string, args ...any)
Panicf(format string, args ...any)
LogBlock(lvl Level, prefix, format string, args ...any)
DebugBlock(prefix string, format string, args ...any)
InfoBlock(prefix string, format string, args ...any)
WarnBlock(prefix string, format string, args ...any)
ErrorBlock(prefix string, format string, args ...any)
WithContext(ctx context.Context) Logger
WithGroup(name string) Logger
WithAttrs(args ...any) Logger
Enabled(ctx context.Context, lvl Level) bool
DebugEnabled() bool
EnableDebug(bool) bool
Flush()
SlogHandler() slog.Handler
}
type OtelHandler ¶ added in v0.13.0
type OtelHandler struct {
// contains filtered or unexported fields
}
func NewOtelHandler ¶ added in v0.13.0
func NewOtelHandler(source string) *OtelHandler
func (*OtelHandler) GetHandler ¶ added in v0.13.0
func (o *OtelHandler) GetHandler() slog.Handler
func (*OtelHandler) NewChildHandlerWithAttrs ¶ added in v0.13.0
func (o *OtelHandler) NewChildHandlerWithAttrs(attrs []Attr) *OtelHandler
func (*OtelHandler) NewChildHandlerWithGroup ¶ added in v0.13.0
func (o *OtelHandler) NewChildHandlerWithGroup(group string) *OtelHandler
Click to show internal directories.
Click to hide internal directories.