Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将马提尼日志路径设置为某个随机文件。它现在显示在控制台中。
m := martini.Classic()
谢谢您的帮助
将一个新的记录器附加到 Martini:
f, err := os.OpenFile("logfile", os.O_RDWR | os.O_CREATE | os.O_APPEND, 0666) if err != nil { t.Fatalf("error opening file: %v", err) } defer f.Close() m.Map(log.New(f, "[martini]", log.LstdFlags))