Created
February 24, 2014 09:17
-
-
Save n5i/9184360 to your computer and use it in GitHub Desktop.
GO: write log
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
// Write to log | |
logf, er := os.OpenFile("/home/go/src/app/event.log", os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0640) | |
if er != nil { | |
log.Fatalln(er) | |
} | |
log.SetOutput(logf) | |
log.Println("START") | |
log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds | log.Lshortfile) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment