How do I use Go Fiber's logger to output to both stdout and a log file?

446 Views Asked by At

Here is the existing logger using a log file called logFile

app.Use(logger.New(logger.Config{
    Format:     "[LOG] ${time} ${status} - ${latency} ${method} ${path}\n",
    TimeFormat: "2006/01/2 15:04:05",
    Output:     logFile,
}))

However, I also want to log to os.Stdout.

Is there a way using Fiber's Config to log to both at the same time? Should I use the io.Writer interface to make my own Writer that logs to a log file and to stdout?

I have so far looked through the following resources and can't find someone doing something similar. I couldn't find more relevant resources about this.

0

There are 0 best solutions below