diff --git a/internal/manager/api_impl/jobs.go b/internal/manager/api_impl/jobs.go index be8ffe22..1e055e83 100644 --- a/internal/manager/api_impl/jobs.go +++ b/internal/manager/api_impl/jobs.go @@ -28,26 +28,25 @@ import ( "github.com/google/uuid" "github.com/labstack/echo/v4" "github.com/rs/zerolog" - "github.com/rs/zerolog/log" "gitlab.com/blender/flamenco-ng-poc/internal/manager/persistence" "gitlab.com/blender/flamenco-ng-poc/pkg/api" ) func (f *Flamenco) GetJobTypes(e echo.Context) error { + logger := requestLogger(e) + if f.jobCompiler == nil { - log.Error().Msg("Flamenco is running without job compiler") + logger.Error().Msg("Flamenco is running without job compiler") return sendAPIError(e, http.StatusInternalServerError, "no job types available") } + logger.Debug().Msg("listing job types") jobTypes := f.jobCompiler.ListJobTypes() return e.JSON(http.StatusOK, &jobTypes) } func (f *Flamenco) SubmitJob(e echo.Context) error { - // TODO: move this into some middleware. - logger := log.With(). - Str("ip", e.RealIP()). - Logger() + logger := requestLogger(e) var job api.SubmitJobJSONRequestBody if err := e.Bind(&job); err != nil { @@ -89,9 +88,8 @@ func (f *Flamenco) SubmitJob(e echo.Context) error { } func (f *Flamenco) FetchJob(e echo.Context, jobId string) error { - // TODO: move this into some middleware. logger := requestLogger(e).With(). - Str("job_id", jobId). + Str("job", jobId). Logger() if _, err := uuid.Parse(jobId); err != nil { diff --git a/internal/manager/api_impl/openapi_auth.go b/internal/manager/api_impl/openapi_auth.go index 92ac799b..47aabc75 100644 --- a/internal/manager/api_impl/openapi_auth.go +++ b/internal/manager/api_impl/openapi_auth.go @@ -48,7 +48,7 @@ func SwaggerValidator(swagger *openapi3.T, persist PersistenceService) echo.Midd // Skip OAPI validation when the request is not for the OAPI interface. Skipper: func(e echo.Context) bool { isOapi := isOpenAPIPath(swagger, e.Path()) - log.Debug(). + log.Trace(). Bool("isOpenAPI", isOapi). Str("path", e.Path()). Msg("checking validation skipperoo") diff --git a/internal/manager/api_impl/zerolog.go b/internal/manager/api_impl/zerolog.go index 9c2aa8b3..084dd5b6 100644 --- a/internal/manager/api_impl/zerolog.go +++ b/internal/manager/api_impl/zerolog.go @@ -27,7 +27,9 @@ import ( ) func requestLogger(e echo.Context) zerolog.Logger { - logCtx := log.With().Str("remoteAddr", e.RealIP()) + logCtx := log.With(). + Str("remoteAddr", e.RealIP()). + Str("userAgent", e.Request().UserAgent()) worker := requestWorker(e) if worker != nil {