2023-02-28 09:10:27 -06:00
|
|
|
package log
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ PrettyLogger = (*prettyLogger)(nil)
|
|
|
|
|
|
|
|
type prettyLogger struct {
|
|
|
|
log Logger
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewPrettyLogger(name string) *prettyLogger {
|
|
|
|
return &prettyLogger{
|
|
|
|
log: New(name),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-30 10:46:47 -05:00
|
|
|
func (l *prettyLogger) Successf(format string, args ...any) {
|
2023-02-28 09:10:27 -06:00
|
|
|
l.log.Info(fmt.Sprintf(format, args...))
|
|
|
|
}
|
|
|
|
|
2023-08-30 10:46:47 -05:00
|
|
|
func (l *prettyLogger) Failuref(format string, args ...any) {
|
2023-02-28 09:10:27 -06:00
|
|
|
l.log.Error(fmt.Sprintf(format, args...))
|
|
|
|
}
|
|
|
|
|
2023-08-30 10:46:47 -05:00
|
|
|
func (l *prettyLogger) Info(args ...any) {
|
2023-02-28 09:10:27 -06:00
|
|
|
l.log.Info(fmt.Sprint(args...))
|
|
|
|
}
|
|
|
|
|
2023-08-30 10:46:47 -05:00
|
|
|
func (l *prettyLogger) Infof(format string, args ...any) {
|
2023-02-28 09:10:27 -06:00
|
|
|
l.log.Info(fmt.Sprintf(format, args...))
|
|
|
|
}
|
|
|
|
|
2023-08-30 10:46:47 -05:00
|
|
|
func (l *prettyLogger) Debug(args ...any) {
|
2023-02-28 09:10:27 -06:00
|
|
|
l.log.Debug(fmt.Sprint(args...))
|
|
|
|
}
|
|
|
|
|
2023-08-30 10:46:47 -05:00
|
|
|
func (l *prettyLogger) Debugf(format string, args ...any) {
|
2023-02-28 09:10:27 -06:00
|
|
|
l.log.Debug(fmt.Sprintf(format, args...))
|
|
|
|
}
|
|
|
|
|
2023-08-30 10:46:47 -05:00
|
|
|
func (l *prettyLogger) Warn(args ...any) {
|
2023-02-28 09:10:27 -06:00
|
|
|
l.log.Warn(fmt.Sprint(args...))
|
|
|
|
}
|
|
|
|
|
2023-08-30 10:46:47 -05:00
|
|
|
func (l *prettyLogger) Warnf(format string, args ...any) {
|
2023-02-28 09:10:27 -06:00
|
|
|
l.log.Warn(fmt.Sprintf(format, args...))
|
|
|
|
}
|
|
|
|
|
2023-08-30 10:46:47 -05:00
|
|
|
func (l *prettyLogger) Error(args ...any) {
|
2023-02-28 09:10:27 -06:00
|
|
|
l.log.Error(fmt.Sprint(args...))
|
|
|
|
}
|
|
|
|
|
2023-08-30 10:46:47 -05:00
|
|
|
func (l *prettyLogger) Errorf(format string, args ...any) {
|
2023-02-28 09:10:27 -06:00
|
|
|
l.log.Error(fmt.Sprintf(format, args...))
|
|
|
|
}
|