package logger import ( "log" "os" ) func init() { file, err := os.OpenFile("./log.txt", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666) if err != nil { panic(any("open log file error")) } log.SetFlags(log.Ldate) //log.SetPrefix("earlyWarningSystem") log.SetOutput(file) }