You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
493 B
24 lines
493 B
package main
|
|
|
|
import (
|
|
"gopkg.in/natefinch/lumberjack.v2"
|
|
"io"
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
// 日志生成文件,配置初始化
|
|
func logInitial() {
|
|
|
|
multiWriter := io.MultiWriter(os.Stdout, &lumberjack.Logger{
|
|
Filename: "./logs/logInfo.log",
|
|
MaxSize: 1, // megabytes
|
|
MaxBackups: 10,
|
|
MaxAge: 30, //days
|
|
//Compress: true,
|
|
})
|
|
log.SetFlags(log.LstdFlags | log.Lshortfile)
|
|
log.SetOutput(multiWriter)
|
|
log.Println("=================log start=================")
|
|
log.Println("==>")
|
|
}
|
|
|