Исправление логирования пачки записей
This commit is contained in:
parent
4d0e04b6c1
commit
0dfc20eaf2
|
@ -12,6 +12,11 @@ func Init(e *echo.Echo) {
|
|||
e.Use(echomiddleware.RequestID())
|
||||
e.Use(echomiddleware.BodyLimit("100M"))
|
||||
e.Use(echomiddleware.Logger())
|
||||
e.Use(echomiddleware.GzipWithConfig(echomiddleware.GzipConfig{
|
||||
Skipper: func(c echo.Context) bool {
|
||||
return strings.Contains(c.Path(), "metrics") // Change "metrics" for your own path
|
||||
},
|
||||
}))
|
||||
//e.Use(echomiddleware.Recover())
|
||||
|
||||
/*swagger, err := Openapi.GetSwagger()
|
||||
|
@ -24,15 +29,17 @@ func Init(e *echo.Echo) {
|
|||
e.Use(logging())
|
||||
}
|
||||
|
||||
var logEvent *log.LogService
|
||||
|
||||
func logging() echo.MiddlewareFunc {
|
||||
logEvent, _ = log.NewLogService(lib.AppConfig.LogEndpoint)
|
||||
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
logging, _ := log.NewLogService(lib.AppConfig.LogEndpoint)
|
||||
return func(c echo.Context) error {
|
||||
if err := next(c); err != nil {
|
||||
c.Error(err)
|
||||
}
|
||||
// TODO
|
||||
logging.AddLog(c)
|
||||
logEvent.AddLog(c)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,9 @@ func defaultHandler(c echo.Context) error {
|
|||
if err != nil {
|
||||
return c.String(http.StatusNotFound, "Page not found")
|
||||
}
|
||||
c.Response().Header().Add("Cache-Control", "no-store, must-revalidate")
|
||||
c.Response().Header().Add("Pragma", "no-store")
|
||||
c.Response().Header().Add("Expires", "0")
|
||||
return c.Blob(http.StatusOK, http.DetectContentType(buff), buff)
|
||||
}
|
||||
contentType := http.DetectContentType(buff)
|
||||
|
@ -44,5 +47,8 @@ func defaultHandler(c echo.Context) error {
|
|||
ext1 := filepath.Ext(c.Request().URL.Path)
|
||||
contentType = mime.TypeByExtension(ext1)
|
||||
}
|
||||
if contentType == "" {
|
||||
contentType = "text/plain"
|
||||
}
|
||||
return c.Blob(http.StatusOK, contentType, buff)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue