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