Skip to content

Instantly share code, notes, and snippets.

@benlemasurier
Created May 11, 2014 01:44
Show Gist options
  • Save benlemasurier/8fdf64f3beda24d02411 to your computer and use it in GitHub Desktop.
Save benlemasurier/8fdf64f3beda24d02411 to your computer and use it in GitHub Desktop.
f, err := os.OpenFile("testlogfile", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
log.Fatalf("error opening file: %v", err)
}
defer f.Close()
log.SetOutput(f)
log.Println(string(body))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment