This commit is contained in:
Eduard Urbach 2017-06-17 01:34:54 +02:00
parent 4ab152d976
commit 47cdff935a

View File

@ -11,15 +11,15 @@ import (
"github.com/aerogo/log" "github.com/aerogo/log"
) )
// Log middleware logs every request into logs/request.log. // Log middleware logs every request into logs/request.log and errors into logs/error.log.
func Log() aero.Middleware { func Log() aero.Middleware {
request := log.NewLog()
request.AddOutput(log.File("logs/request.log"))
err := log.NewLog() err := log.NewLog()
err.AddOutput(log.File("logs/error.log")) err.AddOutput(log.File("logs/error.log"))
err.AddOutput(os.Stderr) err.AddOutput(os.Stderr)
request := log.NewLog()
request.AddOutput(log.File("logs/request.log"))
return func(ctx *aero.Context, next func()) { return func(ctx *aero.Context, next func()) {
start := time.Now() start := time.Now()
next() next()