Documentation ¶
Overview ¶
Package log is for http logging
Index ¶
Constants ¶
View Source
const ( // templates for logging CommonLogFormat = `` /* 243-byte string literal not displayed */ CommonLogFormatUsingXForwardedFor = `` /* 265-byte string literal not displayed */ CommonLogFormatStrippingQueries = `` /* 241-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func CommonLogHandler ¶
CommonLogHandler returns a handler that serves HTTP requests If a logger is not provided, stdout will be used
Types ¶
type HttpLogger ¶
type HttpLogger struct {
// contains filtered or unexported fields
}
func (HttpLogger) Header ¶
func (hl HttpLogger) Header() http.Header
func (HttpLogger) WriteHeader ¶
func (hl HttpLogger) WriteHeader(code int)
type LogData ¶
type LogData struct { Start time.Time End time.Time Request http.Request Response *ResponseWriterWatcher }
func (LogData) UrlUsername ¶
Extract username from the request url
type LoggedResponseBodyWriter ¶
type LoggedResponseBodyWriter struct { Output bytes.Buffer // contains filtered or unexported fields }
func LogResponseBody ¶
func LogResponseBody(rw http.ResponseWriter) *LoggedResponseBodyWriter
func (*LoggedResponseBodyWriter) Header ¶
func (this *LoggedResponseBodyWriter) Header() http.Header
func (*LoggedResponseBodyWriter) Write ¶
func (this *LoggedResponseBodyWriter) Write(p []byte) (int, error)
func (*LoggedResponseBodyWriter) WriteHeader ¶
func (this *LoggedResponseBodyWriter) WriteHeader(h int)
type ResponseWriterWatcher ¶
func WatchResponseWriter ¶
func WatchResponseWriter(rw http.ResponseWriter) *ResponseWriterWatcher
func (*ResponseWriterWatcher) Header ¶
func (l *ResponseWriterWatcher) Header() http.Header
func (*ResponseWriterWatcher) WriteHeader ¶
func (l *ResponseWriterWatcher) WriteHeader(s int)
Click to show internal directories.
Click to hide internal directories.