I see a lot of Go
code that looks like this:
func main() {
response, _, err := http.Get("http://golang.org/")
if err != nil {
fmt.Printf("%s", err)
os.Exit(1)
}
defer response.Body.Close()
contents, err := ioutil.ReadAll(response.Body)
if err != nil {
fmt.Printf("%s", err)
os.Exit(1)
}
fmt.Printf("%s
", string(contents))
}
My questions are:
In production, should I keep these
fmt.Printf
statements? Silly question I am sure but just checkingWhat logging options do you recommend for production code and also dev?