cloudapi: propagate operation/external id
Signed-off-by: Lukas Zapletal <lzap+git@redhat.com>
This commit is contained in:
parent
f3c0daebbf
commit
5ce8f65a58
8 changed files with 169 additions and 41 deletions
18
internal/common/logger_middleware.go
Normal file
18
internal/common/logger_middleware.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// Store context in request logger to propagate correlation ids
|
||||
func LoggerMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
c.SetLogger(&EchoLogrusLogger{
|
||||
Logger: logrus.StandardLogger(),
|
||||
Ctx: c.Request().Context(),
|
||||
})
|
||||
|
||||
return next(c)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue