Documentation
¶
Index ¶
- Constants
- func Alert(msg string, args ...any)
- func AlertContext(ctx context.Context, msg string, args ...any)
- func AppendCtx(parent context.Context, attr slog.Attr) context.Context
- func Critical(msg string, args ...any)
- func CriticalContext(ctx context.Context, msg string, args ...any)
- func Debug(msg string, args ...any)
- func DebugContext(ctx context.Context, msg string, args ...any)
- func Emergency(msg string, args ...any)
- func EmergencyContext(ctx context.Context, msg string, args ...any)
- func EntMutationAttrs(m ent.Mutation) []any
- func Error(msg string, args ...any)
- func ErrorContext(ctx context.Context, msg string, args ...any)
- func ExtractAttrs(err error) []slog.Attr
- func GetErrorAttributes(ctx context.Context, err error) []any
- 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 NewGoogleSlogger(opts *GoogleHandlerOptions) *slog.Logger
- func NewPrettySlogger(opts *PrettyHandlerOptions) *slog.Logger
- func Notice(msg string, args ...any)
- func NoticeContext(ctx context.Context, msg string, args ...any)
- func SetDefault(l *Logger)
- func Warn(msg string, args ...any)
- func WarnContext(ctx context.Context, msg string, args ...any)
- func WrapError(err error, attrs ...slog.Attr) error
- type ErrorWithAttrs
- type GoogleHandler
- type GoogleHandlerOptions
- type Logger
- func (l *Logger) Alert(msg string, args ...any)
- func (l *Logger) AlertContext(ctx context.Context, msg string, args ...any)
- func (l *Logger) Critical(msg string, args ...any)
- func (l *Logger) CriticalContext(ctx context.Context, msg string, args ...any)
- func (l *Logger) Debug(msg string, args ...any)
- func (l *Logger) DebugContext(ctx context.Context, msg string, args ...any)
- func (l *Logger) Emergency(msg string, args ...any)
- func (l *Logger) EmergencyContext(ctx context.Context, msg string, args ...any)
- func (l *Logger) Enabled(ctx context.Context, level slog.Level) bool
- func (l *Logger) Error(msg string, args ...any)
- func (l *Logger) ErrorContext(ctx context.Context, msg string, args ...any)
- func (l *Logger) Handler() slog.Handler
- func (l *Logger) Info(msg string, args ...any)
- func (l *Logger) InfoContext(ctx context.Context, msg string, args ...any)
- func (l *Logger) Log(ctx context.Context, level slog.Level, msg string, args ...any)
- func (l *Logger) LogAttrs(ctx context.Context, level slog.Level, msg string, attrs ...slog.Attr)
- func (l *Logger) Notice(msg string, args ...any)
- func (l *Logger) NoticeContext(ctx context.Context, msg string, args ...any)
- func (l *Logger) Slog() *slog.Logger
- func (l *Logger) Warn(msg string, args ...any)
- func (l *Logger) WarnContext(ctx context.Context, msg string, args ...any)
- func (l *Logger) With(args ...any) *Logger
- func (l *Logger) WithGroup(name string) *Logger
- type PrettyHandler
- type PrettyHandlerOptions
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func AlertContext ¶ added in v1.1.11
AlertContext logs at LevelAlert with the given context using the default logger.
func AppendCtx ¶
Appends an attribute to the context for logging. If the attribute key already exists, it replaces the value instead of appending.
func CriticalContext ¶ added in v1.1.11
CriticalContext logs at LevelCritical with the given context using the default logger.
func DebugContext ¶ added in v1.1.11
DebugContext logs at LevelDebug with the given context using the default logger.
func EmergencyContext ¶ added in v1.1.11
EmergencyContext logs at LevelEmergency with the given context using the default logger.
func EntMutationAttrs ¶ added in v1.1.13
EntMutationAttrs constructs log attributes for the given Ent mutation.
func ErrorContext ¶ added in v1.1.11
ErrorContext logs at LevelError with the given context using the default logger.
func ExtractAttrs ¶ added in v1.1.12
ExtractAttrs extracts all log attributes from an error chain
func GetErrorAttributes ¶ added in v1.1.13
GetErrorAttributes constructs error log attributes for the given error and context.
func InfoContext ¶ added in v1.1.11
InfoContext logs at LevelInfo with the given context using the default logger.
func Log ¶ added in v1.1.11
Log emits a log record with the current time and the given level and message using the default logger.
func LogAttrs ¶ added in v1.1.11
LogAttrs emits a log record with the current time and the given level and message using the default logger.
func NewGoogleSlogger ¶ added in v1.1.11
func NewGoogleSlogger(opts *GoogleHandlerOptions) *slog.Logger
func NewPrettySlogger ¶ added in v1.1.11
func NewPrettySlogger(opts *PrettyHandlerOptions) *slog.Logger
func NoticeContext ¶ added in v1.1.11
NoticeContext logs at LevelNotice with the given context using the default logger.
func SetDefault ¶ added in v1.1.11
func SetDefault(l *Logger)
SetDefault makes l the default Logger.
func WarnContext ¶ added in v1.1.11
WarnContext logs at LevelWarn with the given context using the default logger.
Types ¶
type ErrorWithAttrs ¶ added in v1.1.12
type ErrorWithAttrs struct {
// contains filtered or unexported fields
}
func (*ErrorWithAttrs) Error ¶ added in v1.1.12
func (e *ErrorWithAttrs) Error() string
func (*ErrorWithAttrs) Unwrap ¶ added in v1.1.12
func (e *ErrorWithAttrs) Unwrap() error
type GoogleHandler ¶ added in v1.1.9
type GoogleHandler struct {
// contains filtered or unexported fields
}
func NewGoogleHandler ¶ added in v1.1.9
func NewGoogleHandler(opts *GoogleHandlerOptions) *GoogleHandler
type GoogleHandlerOptions ¶ added in v1.1.9
type Logger ¶ added in v1.1.11
type Logger struct {
// contains filtered or unexported fields
}
Logger wraps slog.Logger with additional methods
func (*Logger) AlertContext ¶ added in v1.1.11
AlertContext logs at LevelAlert with the given context.
func (*Logger) CriticalContext ¶ added in v1.1.11
CriticalContext logs at LevelCritical with the given context.
func (*Logger) DebugContext ¶ added in v1.1.11
DebugContext logs at LevelDebug with the given context.
func (*Logger) EmergencyContext ¶ added in v1.1.11
EmergencyContext logs at LevelEmergency with the given context.
func (*Logger) Enabled ¶ added in v1.1.11
Enabled reports whether the Logger emits log records at the given level.
func (*Logger) ErrorContext ¶ added in v1.1.11
ErrorContext logs at LevelError with the given context.
func (*Logger) InfoContext ¶ added in v1.1.11
InfoContext logs at LevelInfo with the given context.
func (*Logger) Log ¶ added in v1.1.11
Log emits a log record with the current time and the given level and message.
func (*Logger) LogAttrs ¶ added in v1.1.11
LogAttrs emits a log record with the current time and the given level and message.
func (*Logger) NoticeContext ¶ added in v1.1.11
NoticeContext logs at LevelNotice with the given context.
func (*Logger) WarnContext ¶ added in v1.1.11
WarnContext logs at LevelWarn with the given context.
type PrettyHandler ¶
type PrettyHandler struct {
// contains filtered or unexported fields
}
func NewPrettyHandler ¶
func NewPrettyHandler(opts *PrettyHandlerOptions) *PrettyHandler