diff options
author | Unknown <joe2010xtmf@163.com> | 2014-03-19 05:31:38 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-03-19 05:31:38 -0400 |
commit | 04e5d5b71fe39039baf72b27411e7629edbcc6a2 (patch) | |
tree | bcb18b59cf8eed9ff139f3d7da2f3a696a386f8d /web.go | |
parent | c593578a55d2f341fe1690d85ea1b1ec45bea50a (diff) | |
download | gitea-04e5d5b71fe39039baf72b27411e7629edbcc6a2.tar.gz gitea-04e5d5b71fe39039baf72b27411e7629edbcc6a2.zip |
Use custom logger middleware
Diffstat (limited to 'web.go')
-rw-r--r-- | web.go | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -46,11 +46,22 @@ func checkRunMode() { log.Info("Run Mode: %s", strings.Title(martini.Env)) } +func newMartini() *martini.ClassicMartini { + r := martini.NewRouter() + m := martini.New() + m.Use(middleware.Logger()) + m.Use(martini.Recovery()) + m.Use(martini.Static("public")) + m.MapTo(r, (*martini.Routes)(nil)) + m.Action(r.Handle) + return &martini.ClassicMartini{m, r} +} + func runWeb(*cli.Context) { checkRunMode() log.Info("%s %s", base.AppName, base.AppVer) - m := martini.Classic() + m := newMartini() // Middlewares. m.Use(render.Renderer(render.Options{Funcs: []template.FuncMap{base.TemplateFuncs}})) |