42 lines
799 B
Go
42 lines
799 B
Go
package logger
|
|
|
|
import (
|
|
"context"
|
|
"log/slog"
|
|
)
|
|
|
|
var (
|
|
log Logger
|
|
)
|
|
|
|
func init() {
|
|
log = NewLogger(slog.Default())
|
|
}
|
|
|
|
type Logger interface {
|
|
Debug(ctx context.Context, format string, args ...any)
|
|
Info(ctx context.Context, format string, args ...any)
|
|
Warn(ctx context.Context, format string, args ...any)
|
|
Error(ctx context.Context, format string, args ...any)
|
|
}
|
|
|
|
func Debug(ctx context.Context, format string, args ...any) {
|
|
log.Debug(ctx, format, args...)
|
|
}
|
|
|
|
func Info(ctx context.Context, format string, args ...any) {
|
|
log.Debug(ctx, format, args...)
|
|
}
|
|
|
|
func Warn(ctx context.Context, format string, args ...any) {
|
|
log.Debug(ctx, format, args...)
|
|
}
|
|
|
|
func Error(ctx context.Context, format string, args ...any) {
|
|
log.Debug(ctx, format, args...)
|
|
}
|
|
|
|
func Default() Logger {
|
|
return log
|
|
}
|