Skip to content

Commit

Permalink
Changes logs from info to debug, added API TRACE as the tag
Browse files Browse the repository at this point in the history
  • Loading branch information
louisg1337 committed Jun 20, 2024
1 parent c053e51 commit 9d9a3fc
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion manager/api/api.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions manager/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (s *Server) LookupChargeStationAuth(w http.ResponseWriter, r *http.Request,
}

func (s *Server) TriggerChargeStation(w http.ResponseWriter, r *http.Request, csId string) {
slog.Info("[TEST] in TriggerChargeStation!")
slog.Debug("[API TRACE] in TriggerChargeStation!")
req := new(ChargeStationTrigger)
if err := render.Bind(r, req); err != nil {
_ = render.Render(w, r, ErrInvalidRequest(err))
Expand All @@ -174,15 +174,15 @@ func (s *Server) TriggerChargeStation(w http.ResponseWriter, r *http.Request, cs
}

func (s *Server) SetChargingProfile(w http.ResponseWriter, r *http.Request, csId string) {
slog.Info("[TEST] In server.go, SetChargingProfile()")
slog.Debug("[API TRACE] In server.go, SetChargingProfile()")
req := new(ChargingProfileType)

if err := render.Bind(r, req); err != nil {
_ = render.Render(w, r, ErrInvalidRequest(err))
return
}

slog.Info("[TEST] req:", req)
slog.Debug("[API TRACE] req:", req)

// Get the transport.Emitter so that we can send messages
cfg := config.DefaultConfig
Expand Down
7 changes: 1 addition & 6 deletions manager/handlers/call_maker.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,9 @@ type OcppCallMaker struct {
Actions map[reflect.Type]string // the OCPP Action associated with a specific ocpp.Request object
}

type SetChargingProfileRequestJsonFix struct {
evseId int
chargingProfile interface{}
}

func (b OcppCallMaker) Send(ctx context.Context, chargeStationId string, request ocpp.Request) error {
action, ok := b.Actions[reflect.TypeOf(request)]
slog.Info("[TEST] we are in Send() in call_maker.go", "action", action)
slog.Debug("[API TRACE] we are in Send() in call_maker.go", "action", action)
if !ok {
slog.Error("unknown request type", request)
return nil
Expand Down
2 changes: 1 addition & 1 deletion manager/handlers/ocpp201/set_charging_profile_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func (h SetChargingProfileResultHandler) HandleCallResult(ctx context.Context, c
req := request.(*types.SetChargingProfileRequestJson)
resp := response.(*types.SetChargingProfileResponseJson)

slog.Info("[TEST] in scp_result.go, got response:", resp, "[TEST] From request:", req)
slog.Debug("[API TRACE] in scp_result.go, got response:", resp, "[API TRACE] From request:", req)

return nil
}
6 changes: 3 additions & 3 deletions manager/handlers/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ func (r Router) Handle(ctx context.Context, chargeStationId string, msg *transpo
}

func (r Router) route(ctx context.Context, chargeStationId string, message *transport.Message) error {
slog.Info("[TEST] we are in route() in router.go", "action", message.Action)
slog.Debug("[API TRACE] we are in route() in router.go", "action", message.Action)
switch message.MessageType {
case transport.MessageTypeCall:
route, ok := r.CallRoutes[message.Action]
slog.Info("[TEST] we are in route() in router.go, in MessageTypeCall", "route", route)
slog.Debug("[API TRACE] we are in route() in router.go, in MessageTypeCall", "route", route)
if !ok {
return fmt.Errorf("routing request: %w", transport.NewError(transport.ErrorNotImplemented, fmt.Errorf("%s not implemented", message.Action)))
}
Expand Down Expand Up @@ -107,7 +107,7 @@ func (r Router) route(ctx context.Context, chargeStationId string, message *tran
}
case transport.MessageTypeCallResult:
route, ok := r.CallResultRoutes[message.Action]
slog.Info("[TEST] we are in route() in router.go, in MessageTypeCallResult", "route", route)
slog.Debug("[API TRACE] we are in route() in router.go, in MessageTypeCallResult", "route", route)
if !ok {
return fmt.Errorf("routing request: %w", transport.NewError(transport.ErrorNotImplemented, fmt.Errorf("%s result not implemented", message.Action)))
}
Expand Down
2 changes: 1 addition & 1 deletion manager/sync/triggers.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func SyncTriggers(ctx context.Context,
trace.WithAttributes(attribute.String("sync.trigger.previous", previousChargeStationId)))
defer span.End()
triggerMessages, err := engine.ListChargeStationTriggerMessages(ctx, 50, previousChargeStationId)
slog.Info("[TEST] we are in SyncTriggers() in triggers.go", "triggerMessages", triggerMessages)
slog.Debug("[API TRACE] we are in SyncTriggers() in triggers.go", "triggerMessages", triggerMessages)
if err != nil {
span.RecordError(err)
return
Expand Down

0 comments on commit 9d9a3fc

Please sign in to comment.