25 lines
308 B
Go
25 lines
308 B
Go
|
package logger
|
||
|
|
||
|
import (
|
||
|
"io"
|
||
|
"os"
|
||
|
|
||
|
"github.com/sirupsen/logrus"
|
||
|
)
|
||
|
|
||
|
func NewLogger(output io.Writer) *logrus.Logger {
|
||
|
l := logrus.New()
|
||
|
|
||
|
l.SetFormatter(&logrus.TextFormatter{})
|
||
|
|
||
|
l.SetLevel(logrus.DebugLevel)
|
||
|
|
||
|
if output != nil {
|
||
|
l.SetOutput(output)
|
||
|
} else {
|
||
|
l.SetOutput(os.Stdout)
|
||
|
}
|
||
|
|
||
|
return l
|
||
|
}
|