Created
January 21, 2020 07:34
-
-
Save pauldan/0c881eb6875f11eeb418e7dff46703d7 to your computer and use it in GitHub Desktop.
log to file - golang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f, err := os.OpenFile("tmp/info.log", os.O_RDWR|os.O_CREATE, 0666) | |
if err != nil { | |
log.Fatal(err) | |
} | |
defer f.Close() | |
infoLog := log.New(f, "INFO ", log.Ldate|log.Ltime) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment