Monday, August 29, 2011

Logging to Multiple Destinations

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

/* MIKI: Analytics */