FAQ
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

  • Pranav Raja at Dec 19, 2013 at 7:02 am
    Something like this (http://play.golang.org/p/6E6grsIts9) works for me
    locally.
    On Thursday, 19 December 2013 15:01:38 UTC+11, 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.
  • Craig Mason-Jones at Dec 20, 2013 at 3:07 am
    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.

Related Discussions

Discussion Navigation
viewthread | post
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 © 2022 Grokbase