Use own logger for errors

Sofar we've used the default logger within the log package. The purpose of a logger is write a decorated message to some destination. The default is stderr with no prefix including a timestamp. Let's create our own logger so that it's easier to replace it later on.
func main() { + log := log.New(os.Stderr, "", log.LstdFlags) err := http.ListenAndServe(":8080", NewRouter()) if err != nil { log.Print(err)
prev toc next