codegangsta/martini — pull request #147 by JamesClonk (2014-01-05 00:57:14+00:00)
Title: Added option to disable logging when serving static assets

I added an optional parameter to Static(), to disable logging when serving static assets.

The reason for this is that my current project has a lot of static CSS, JS, etc. files that are served with each GET request. This produces a lot of "spam" that I don't want / need to have in my logfile/stdout.

The new variadic bool parameter for Static() is called skipLogging.
If it is set to true, no logging output will be produced. Since the default for a missing parameter / bool is false, this change is fully backwards compatible.

Example:

```
//m := martini.Classic()
r := martini.NewRouter()
m := martini.New()
m.Use(martini.Recovery())
m.Use(martini.Static("public", true)) // skip logging on static content
m.Use(martini.Logger()) // place Logger after Static
m.Action(r.Handle)

r.Get("/", index)
m.Run()

// Output:
// [martini] listening on port 3000
// [martini] Started GET /
// [martini] Completed 200 OK in 615.252us
```

vs. before:

```
m := martini.Classic()

m.Get("/", index)
m.Run()

// Output:
// [martini] listening on port 3000
// [martini] Started GET /
// [martini] Completed 200 OK in 604.306us
// [martini] Started GET /stylesheets/base.css
// [martini] [Static] Serving /stylesheets/base.css
// [martini] Completed 304 Not Modified in 52.72us
// [martini] Started GET /stylesheets/custom.css
// [martini] [Static] Serving /stylesheets/custom.css
// [martini] Completed 304 Not Modified in 36.677us
// [martini] Started GET /stylesheets/layout.css
// [martini] [Static] Serving /stylesheets/layout.css
// [martini] Completed 304 Not Modified in 32.378us
// [martini] Started GET /stylesheets/skeleton.css
// [martini] [Static] Serving /stylesheets/skeleton.css
// [martini] Completed 304 Not Modified in 33.953us
// [martini] Started GET /images/bg.png
// [martini] [Static] Serving /images/bg.png
// [martini] Completed 304 Not Modified in 42.832us
// [martini] Started GET /images/color.png
// [martini] [Static] Serving /images/color.png
// [martini] Completed 304 Not Modified in 37.132us
```