Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var LongBodyThreshold = 100
LongBodyThreshold is the body length threshold beyond which the body will be written to a file. Otherwise, if the content is textual, it is written inline in the log.
This is ignored unless level == WithHeadersAndBodies.
var TimeFormat = "15:04:05"
TimeFormat sets the appearance of the timestamp that prefixes each logged message. The default is "15:04:05". See time.Format.
Functions ¶
func SyncWriter ¶
SyncWriter wraps a io.Writer so that each call to Write is protected by a mutex. Use this to wrap the call to writer's Write method if it is not thread safe.
Note that you do not need this wrapper for os.File Write operations on POSIX and Windows systems as they are already thread-safe.
Types ¶
type Logger ¶
Logger is a function that processes log items, e.g. by writing them to a log file.
func FileLogger ¶
FileLogger returns a new Logger writing to a file in dir. The name of the file is provided. The same directory specifies where request and response bodies will be written as files. The current directory is used if this is "." or blank.