日志打印

 
💡
Notion Tip: Use this template to codify the process around a feature launch.
file, err := os.OpenFile("err.txt", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666)
log.SetOutput(file)
defer func(file *os.File) {
			err := file.Close()
			if err != nil {
				log.Println("日志文件关闭失败")
			}
		}(file)
log.Println("xxx")