The golog package is a fork of Go’s log package. It is functionally identical to Go’s log package which makes it a drop-in replacement with a few added features. The New method is variadic so it can be called using zero to four arguments; the optional fourth argument will set the logging level. The New method accepts a filename as the first argument. Also, the Printf method accepts a logging level parameter.
logger = golog.New("/tmp/mylog.log") logger.Printf("Hello file") // outputs to file: 2017-11-11 01:23:45 Hello file