Beispiel #1
0
func SetMiddlewares(m *macaron.Macaron) {
	m.Use(macaron.Static("static", macaron.StaticOptions{
		Expires: func() string { return "max-age=0" },
	}))

	m.Map(Log)
	m.Use(logger())

	m.Use(macaron.Recovery())
}
Beispiel #2
0
func SetMiddlewares(m *macaron.Macaron) {
	m.Use(macaron.Static("static", macaron.StaticOptions{
		Expires: func() string { return "max-age=0" },
	}))

	InitLog(setting.RunMode, setting.LogPath)

	m.Map(Log)
	m.Use(logger(setting.RunMode))

	m.Use(macaron.Recovery())
}
Beispiel #3
0
func SetMiddlewares(m *macaron.Macaron) {
	//设置静态文件目录,静态文件的访问不进行日志输出
	m.Use(macaron.Static("static", macaron.StaticOptions{
		Expires: func() string { return "max-age=0" },
	}))

	//设置全局 Logger
	m.Map(Log)
	//设置 logger 的 Handler 函数,处理所有 Request 的日志输出
	m.Use(logger())

	//设置 panic 的 Recovery
	m.Use(macaron.Recovery())
}
Beispiel #4
0
func SetMiddlewares(m *macaron.Macaron) {
	//Set static file directory,static file access without log output
	m.Use(macaron.Static("external", macaron.StaticOptions{
		Expires: func() string { return "max-age=0" },
	}))

	InitLog(setting.RunMode, setting.LogPath)

	//Set global Logger
	m.Map(Log)
	//Set logger handler function, deal with all the Request log output
	m.Use(logger(setting.RunMode))

	//Set the response header info
	m.Use(setRespHeaders())

	//Set recovery handler to returns a middleware that recovers from any panics
	m.Use(macaron.Recovery())
}
Beispiel #5
0
func SetMiddlewares(m *macaron.Macaron) {
	m.Use(macaron.Static("external", macaron.StaticOptions{
		Expires: func() string { return "max-age=0" },
	}))

	m.Map(Log)
	//modify  default template setting
	m.Use(macaron.Renderer(macaron.RenderOptions{
		Directory:       "views",
		Extensions:      []string{".tmpl", ".html"},
		Funcs:           []template.FuncMap{},
		Delims:          macaron.Delims{"<<<", ">>>"},
		Charset:         "UTF-8",
		IndentJSON:      true,
		IndentXML:       true,
		PrefixXML:       []byte("macaron"),
		HTMLContentType: "text/html",
	}))
	m.Use(macaron.Recovery())
}