Tweak some logging
This commit is contained in:
parent
0235ffcb4a
commit
bbc6a3f69e
@ -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 {
|
||||
|
@ -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")
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user