first commit
This commit is contained in:
commit
5203032b83
25 changed files with 2825 additions and 0 deletions
27
bootstrap/logs.go
Normal file
27
bootstrap/logs.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package bootstrap
|
||||
|
||||
import (
|
||||
"github.com/sirupsen/logrus"
|
||||
"gopkg.in/natefinch/lumberjack.v2"
|
||||
"io"
|
||||
)
|
||||
|
||||
func Logs() {
|
||||
TextFormatter := &logrus.TextFormatter{
|
||||
FullTimestamp: true,
|
||||
TimestampFormat: "15:04:05 02-01-2006",
|
||||
DisableQuote: true,
|
||||
PadLevelText: true,
|
||||
}
|
||||
logWriter := &lumberjack.Logger{
|
||||
Filename: "log.txt",
|
||||
Compress: true,
|
||||
MaxSize: 50,
|
||||
LocalTime: true,
|
||||
}
|
||||
output := io.MultiWriter(logWriter)
|
||||
|
||||
logrus.SetFormatter(TextFormatter)
|
||||
logrus.SetOutput(output)
|
||||
logrus.SetLevel(logrus.InfoLevel)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue