mirror of
https://github.com/tarampampam/error-pages.git
synced 2024-08-30 18:22:40 +00:00
15 lines
411 B
Go
15 lines
411 B
Go
package logger
|
|
|
|
import (
|
|
stdLog "log"
|
|
)
|
|
|
|
// NewStdLog returns a *[log.Logger] which writes to the supplied [Logger] at [InfoLevel].
|
|
func NewStdLog(log *Logger) *stdLog.Logger {
|
|
return stdLog.New(&loggerWriter{log} /* prefix */, "" /* flags */, 0)
|
|
}
|
|
|
|
type loggerWriter struct{ log *Logger }
|
|
|
|
func (lw *loggerWriter) Write(p []byte) (int, error) { lw.log.Info(string(p)); return len(p), nil } //nolint:nlreturn
|