Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Example ¶
// create new logger using the default `slog.Logger`. hl := NewLogger(slog.Default()) // create new mux so we can easily forward it with the middleware. mux := http.NewServeMux() // handle all requests with a "Hello World" response. mux.HandleFunc("/", func(writer http.ResponseWriter, request *http.Request) { writer.Write([]byte("Hello World")) }) // listen and serve using the logger as a middleware. err := http.ListenAndServe(":8080", hl.Handler(mux)) if err != nil { panic(err) }
Output:
type ResponseWriter ¶
type ResponseWriter struct { Writer http.ResponseWriter // contains filtered or unexported fields }
func (*ResponseWriter) Header ¶
func (w *ResponseWriter) Header() http.Header
func (*ResponseWriter) WriteHeader ¶
func (w *ResponseWriter) WriteHeader(s int)
Click to show internal directories.
Click to hide internal directories.