Skip to content

Commit

Permalink
Add logger to e2core server (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
javorszky committed Mar 21, 2023
1 parent 7b0b0fd commit 19b008e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions e2core/server/handlers.go
Expand Up @@ -17,8 +17,15 @@ func (s *Server) executePluginByNameHandler() echo.HandlerFunc {
namespace := ReadParam(c, "namespace")
name := ReadParam(c, "name")

ll := s.logger.With().
Str("ident", ident).
Str("namespace", namespace).
Str("fn", name).
Logger()

mod := s.syncer.GetModuleByName(ident, namespace, name)
if mod == nil {
ll.Error().Msg("syncer did not find module by these details")
return echo.NewHTTPError(http.StatusNotFound, "module not found")
}

Expand All @@ -32,6 +39,10 @@ func (s *Server) executePluginByNameHandler() echo.HandlerFunc {
return echo.NewHTTPError(http.StatusInternalServerError, "failed to handle request").SetInternal(err)
}

ll.Info().
Str("fqmn", mod.FQMN).
Msg("found module with fqmn")

steps := []tenant.WorkflowStep{{FQMN: mod.FQMN}}

// a sequence executes the handler's steps and manages its state.
Expand Down
2 changes: 2 additions & 0 deletions e2core/server/server.go
Expand Up @@ -30,6 +30,7 @@ type Server struct {
dispatcher *dispatcher

options *options.Options
logger zerolog.Logger
}

// New creates a new Server instance.
Expand Down Expand Up @@ -67,6 +68,7 @@ func New(l zerolog.Logger, sync *syncer.Syncer, opts *options.Options) (*Server,
options: opts,
bus: b,
dispatcher: d,
logger: ll,
}

if opts.AdminEnabled() {
Expand Down

0 comments on commit 19b008e

Please sign in to comment.