21 lines
606 B
Go
Raw Normal View History

2017-06-05 18:21:06 +00:00
package main
// loggerConfig := zap.NewDevelopmentConfig()
// loggerConfig.OutputPaths = append(loggerConfig.OutputPaths, "logs/server.log")
// logger, _ := loggerConfig.Build()
// logTime := func(ctx *aero.Context, next func()) {
// start := time.Now()
// next()
// responseTime := time.Since(start)
// if ctx.StatusCode == 200 {
// logger.Info(ctx.URI(), zap.Duration("responseTime", responseTime), zap.Int("statusCode", ctx.StatusCode))
// } else {
// logger.Warn(ctx.URI(), zap.Duration("responseTime", responseTime), zap.Int("statusCode", ctx.StatusCode))
// }
// }
// app.Use(logTime)