Files
atom/providers/log/gin_level_writer.go
2023-04-20 12:11:34 +08:00

21 lines
276 B
Go

package log
import (
"strings"
)
type LevelWriter struct {
Level Level
}
func (w LevelWriter) Write(p []byte) (n int, err error) {
str := strings.TrimSpace(string(p))
switch w.Level {
case InfoLevel:
Info(str)
case ErrorLevel:
Error(str)
}
return len(p), nil
}