EdgexAgent/device-gps-go/vendor/github.com/spiffe/go-spiffe/v2/logger/writer.go
2025-07-10 20:30:06 +08:00

32 lines
684 B
Go

package logger
import (
"fmt"
"io"
)
// Writer provides a logger that outputs logging to the given writer.
func Writer(w io.Writer) Logger {
return writer{Writer: w}
}
type writer struct {
io.Writer
}
func (w writer) Debugf(format string, args ...interface{}) {
fmt.Fprintf(w.Writer, "[DEBUG] "+format+"\n", args...)
}
func (w writer) Infof(format string, args ...interface{}) {
fmt.Fprintf(w.Writer, "[INFO] "+format+"\n", args...)
}
func (w writer) Warnf(format string, args ...interface{}) {
fmt.Fprintf(w.Writer, "[WARN] "+format+"\n", args...)
}
func (w writer) Errorf(format string, args ...interface{}) {
fmt.Fprintf(w.Writer, "[ERROR] "+format+"\n", args...)
}