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.
25 lines
493 B
25 lines
493 B
2 weeks ago
|
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("==>")
|
||
|
}
|