FAQ
Gorilla's LoggingHandler or CombinedLoggingHandler makes this very easy.

http://www.gorillatoolkit.org/pkg/handlers

An example:

package main

import (
     "net/http"
     "os"
     "github.com/gorilla/handlers"
)

func main() {
     http.Handle("/", handlers.CombinedLoggingHandler(os.Stdout,
http.FileServer(http.Dir("."))))
     http.ListenAndServe(":8123", nil)
}

All the best,
Craig

On Thursday, December 19, 2013 6:01:38 AM UTC+2, Jon Renner wrote:

How would I go about getting a log of traffic to the built-in http File
Server?

This is what I have so far, yet it does not work (no fileserver):
http://play.golang.org/p/qwvn5vFc89
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 3 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 19, '13 at 4:01a
activeDec 20, '13 at 3:07a
posts3
users3
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase