By default, the log package logs to standard output. However a lot of time I like to log both to screen and to a log file. This is where io.MultiWriter comes in handy, just wrap os.Stdout and your log file in one of these and you're good to go.
Below is a small example on how to do that:
No comments:
Post a Comment