Documentation ¶
Overview ¶
Package apachelog is a library for logging the responses of an http.Handler in the Apache Common Log Format. It uses a variant of this log format (http://httpd.apache.org/docs/1.3/logs.html#common) also used by Rack::CommonLogger in Ruby. The format has an additional field at the end for the response time in seconds.
Using apachelog is typically very simple. You'll need to create an http.Handler and set up your request routing first. In a simple web application, for example, you might just use http.NewServeMux(). Next, wrap the http.Handler in an apachelog handler using NewHandler, create an http.Server with this handler, and you're good to go.
Example:
mux := http.NewServeMux() mux.HandleFunc("/", handler) loggingHandler := apachelog.NewHandler(mux, os.Stderr) server := &http.Server{ Addr: ":8899", Handler: loggingHandler, } server.ListenAndServe()
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrHijackingNotSupported = errors.New("hijacking is not supported")
Functions ¶
Types ¶
This section is empty.