golang logrus multiple output to different files
import (
log "github.com/sirupsen/logrus"
"os"
)
func main() {
if file, err := os.OpenFile("log1.log", os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0666); err == nil {
log.SetOutput(file)
}
// Creates a new logger
var logTwo = log.New()
if file, err := os.OpenFile("log2.log", os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0666); err == nil {
logTwo.SetOutput(file)
}
log.Info("output to log1")
logTwo.Info("output to log2")
}