Overview
How to use log.Logger with io.MultiWriter.
In case of writting STDOUT and File
Example
package main
import (
"io"
"log"
"os"
)
func main() {
logFile, _ := os.Create("log.txt")
defer logFile.Close()
mw := io.MultiWriter(os.Stdout, logFile)
logger := log.New(mw, "prefix ", log.LstdFlags)
logger.Println("test")
}