telegram-ollama-reply-bot/bot/logger.go
Alexey Skobkin 3fa7c2434f
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Fix #17. Implementing slog-based logger for telego and passing it into the library.
2024-03-12 23:05:52 +03:00

25 lines
372 B
Go

package bot
import (
"fmt"
"log/slog"
)
type Logger struct {
prefix string
}
func NewLogger(prefix string) Logger {
return Logger{
prefix: prefix,
}
}
func (l Logger) Debugf(format string, args ...any) {
slog.Debug(l.prefix + fmt.Sprint(format, args))
}
func (l Logger) Errorf(format string, args ...any) {
slog.Error(l.prefix + fmt.Sprintf(format, args))
}