Documentation ¶
Index ¶
- type Client
- type ClientGetter
- type DebugContextFunc
- type DebugFunc
- type EnabledFunc
- type ErrorContextFunc
- type ErrorFunc
- type HandlerFunc
- type InfoContextFunc
- type InfoFunc
- type LogAttrsFunc
- type LogFunc
- type TestLog
- type TestLogSource
- type WarnContextFunc
- type WarnFunc
- type WithFunc
- type WithGroupFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // CloneWithUpdates - returns a new client with the given attributes in each output CloneWithUpdates( debugFunc DebugFunc, debugContextFunc DebugContextFunc, enabledFunc EnabledFunc, errorFunc ErrorFunc, errorContextFunc ErrorContextFunc, handlerFunc HandlerFunc, infoFunc InfoFunc, infoContextFunc InfoContextFunc, logFunc LogFunc, logAttrsFunc LogAttrsFunc, logger *slog.Logger, warnFunc WarnFunc, warnContextFunc WarnContextFunc, withFunc WithFunc, withGroupFunc WithGroupFunc, ) Client // Debug - log a debug message Debug(format string, args ...interface{}) // DebugContext - log a debug message with context DebugContext(context context.Context, format string, args ...interface{}) // Enabled - check if logs will emit with given context and level Enabled(context context.Context, level slog.Level) bool // Error - log an error Error(format string, args ...interface{}) // ErrorContext - log an error ErrorContext(context context.Context, format string, args ...interface{}) // Handler - return a slog.Handler in use by the client Handler() slog.Handler // Info - log an info message Info(format string, args ...interface{}) // InfoContext - log an info message with context InfoContext(context context.Context, format string, args ...interface{}) // Log - log a message Log(context context.Context, level slog.Level, format string, args ...interface{}) // LogAttrs - log a message with attributes LogAttrs(context context.Context, level slog.Level, msg string, attrs ...slog.Attr) // Logger - return the logger in use by the client Logger() *slog.Logger // Warn - log a warning message Warn(format string, args ...interface{}) // WarnContext - log a warning message with context WarnContext(context context.Context, format string, args ...interface{}) // With - returns a new client with the given attributes in each output With(args ...interface{}) *Client // WithGroup - returns a new client with the group for each output (affects all other attrs given the handler's processing) WithGroup(group string) *Client }
Client holds the functions to handle logging
func NewClient ¶
func NewClient( debugFunc DebugFunc, debugContextFunc DebugContextFunc, enabledFunc EnabledFunc, errorFunc ErrorFunc, errorContextFunc ErrorContextFunc, handlerFunc HandlerFunc, infoFunc InfoFunc, infoContextFunc InfoContextFunc, logFunc LogFunc, logAttrsFunc LogAttrsFunc, logger *slog.Logger, warnFunc WarnFunc, warnContextFunc WarnContextFunc, withFunc WithFunc, withGroupFunc WithGroupFunc, ) Client
NewClient returns a new Logging client with the provided configuration
type ClientGetter ¶
type ClientGetter struct{}
ClientGetter is an interface for getting an BB log client.
type DebugContextFunc ¶
DebugContextFunc type
type ErrorContextFunc ¶
ErrorContextFunc type
type InfoContextFunc ¶
InfoContextFunc type
type LogAttrsFunc ¶
LogAttrsFunc type // golangci-lint complains about stuttering, but this is the best name for this type
type LogFunc ¶
LogFunc type // golangci-lint complains about stuttering, but this is the best name for this type
type TestLog ¶
type TestLog struct { Time string `json:"time"` Level string `json:"level"` Source TestLogSource `json:"source"` Message string `json:"msg"` }
TestLog type
type TestLogSource ¶
type TestLogSource struct { Function string `json:"function"` File string `json:"file"` Line int `json:"line"` }
TestLogSource type
type WarnContextFunc ¶
WarnContextFunc type
Click to show internal directories.
Click to hide internal directories.