Documentation ¶
Overview ¶
Package log provides handlers for logging request access and panics.
Index ¶
Constants ¶
View Source
const AccessDateFormat = "Jan 2, 2006 at 3:04pm (MST)"
AccessDateFormat is the default timestamp format for the access log messages.
View Source
const PanicDateFormat = "Jan 2, 2006 at 3:04pm (MST)"
PanicDateFormat is the default timestamp format for the panic messages.
Variables ¶
This section is empty.
Functions ¶
func Access ¶
Access returns a handler that writes an access log message to the provided logger, provided by the options, whenever the handler h is invoked. The log message is of the following format:
IP - USER [DATETIME - DURATION] "HTTP_METHOD URI" STATUS_CODE BODY_LENGTH "REFERER" USER_AGENT
By default, all messages are printed to os.Stdout.
Types ¶
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
An Option is used to change the default behaviour of logging handlers.
var ( // ShowStack will cause the stack to be printed out in the // http.ResponseWriter. Only used by the Panic handler. ShowStack Option = showStack )
Click to show internal directories.
Click to hide internal directories.