Documentation
¶
Index ¶
- func Debug(msg string, args ...any)
- func DebugContext(ctx context.Context, msg string, args ...any)
- func Discard() *slog.Logger
- func Error(msg string, args ...any)
- func ErrorContext(ctx context.Context, msg string, args ...any)
- func FromContext(ctx context.Context) *slog.Logger
- func GetLogger() *slog.Logger
- func Info(msg string, args ...any)
- func InfoContext(ctx context.Context, msg string, args ...any)
- func Log(ctx context.Context, level slog.Level, msg string, args ...any)
- func LogAttrs(ctx context.Context, level slog.Level, msg string, attrs ...slog.Attr)
- func MergeGlobalExtraFields(extraFields map[string]interface{})
- func NewLogger(level string) *slog.Logger
- func SetLogger(l *slog.Logger)
- func SetSourceLevels(levels []slog.Level)
- func Warn(msg string, args ...any)
- func WarnContext(ctx context.Context, msg string, args ...any)
- func With(args ...any) *slog.Logger
- func WithAttrs(attrs ...any) *slog.Logger
- func WithGroup(name string) *slog.Logger
- func WithLogger(ctx context.Context, logger *slog.Logger) context.Context
- type GCPHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DebugContext ¶
DebugContext calls [Logger.DebugContext] on the default logger.
func ErrorContext ¶
ErrorContext calls [Logger.ErrorContext] on the default logger.
func FromContext ¶
FromContext retrieves the logger from context
func InfoContext ¶
InfoContext calls [Logger.InfoContext] on the default logger.
func MergeGlobalExtraFields ¶
func MergeGlobalExtraFields(extraFields map[string]interface{})
MergeGlobalExtraFields merges extra fields into the global extra fields
func SetSourceLevels ¶ added in v0.1.2
SetSourceLevels sets the source levels for the logger this only has effect if the logger is not already initialized
func WarnContext ¶
WarnContext calls [Logger.WarnContext] on the default logger.
Types ¶
type GCPHandler ¶
type GCPHandler struct {
// contains filtered or unexported fields
}
GCPHandler is a slog.Handler that formats logs for GCP Cloud Logging
func NewGCPHandler ¶
NewGCPHandler creates a new GCP Cloud Logging compatible handler
Click to show internal directories.
Click to hide internal directories.