Documentation
¶
Overview ¶
prettylogger is a minimalistic server logging framework that prints out the request time, duration, http verb, url path, and color coded response code. You start by passing all the places you want to log to that satify the io.Writer interface to the NewPrettyLogger function. Common places might be STDOUT or a log file. This will return a PrettyLogger struct. You can then use the PrettyLoggerMiddleWare function on the struct to wrap any http.Handlerfunc.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrettyLogger ¶
This struct is the main object of the prettylogger package. You can create one of these yourself with you output locations as writers, or use the NewPrettyLogger function
func NewPrettyLogger ¶
func NewPrettyLogger(writers ...io.Writer) PrettyLogger
Pass all the places you want to log to as writers and this will return a new PrettyLogger struct for you to use
func (PrettyLogger) PrettyLoggerMiddleWare ¶
func (p PrettyLogger) PrettyLoggerMiddleWare(f func(http.ResponseWriter, *http.Request)) http.HandlerFunc
Once you have a PrettyLogger struct, use this function on the struct to wrap http.Handlefunc in order to log all the requests that go though it.
