Skip to content
Permalink
master
Go to file
 
 
Cannot retrieve contributors at this time
18 lines (14 sloc) 255 Bytes
package main
import (
"log"
"os"
)
func main() {
file, err := os.OpenFile("info.log", os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644)
if err != nil {
log.Fatal(err)
}
defer file.Close()
log.SetOutput(file)
log.Print("Logging to a file in Go!")
}
You can’t perform that action at this time.