Skip to content

Commit

Permalink
Changed from error to errorcontext
Browse files Browse the repository at this point in the history
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
  • Loading branch information
nyagamunene committed May 9, 2024
1 parent e39d294 commit e6b8974
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions coap/api/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (lm *loggingMiddleware) Publish(ctx context.Context, key string, msg *messa
}
if err != nil {
args = append(args, slog.Any("error", err))
lm.logger.Error("Publish message failed to complete successfully", args...)
lm.logger.ErrorContext(ctx, "Publish message failed to complete successfully", args...)
return
}
lm.logger.Info("Publish message completed successfully", args...)
Expand All @@ -61,7 +61,7 @@ func (lm *loggingMiddleware) Subscribe(ctx context.Context, key, chanID, subtopi
}
if err != nil {
args = append(args, slog.Any("error", err))
lm.logger.Error("Subscribe failed to complete successfully", args...)
lm.logger.ErrorContext(ctx, "Subscribe failed to complete successfully", args...)
return
}
lm.logger.Info("Subscribe completed successfully", args...)
Expand All @@ -83,7 +83,7 @@ func (lm *loggingMiddleware) Unsubscribe(ctx context.Context, key, chanID, subto
}
if err != nil {
args = append(args, slog.Any("error", err))
lm.logger.Error("Unsubscribe failed to complete successfully", args...)
lm.logger.ErrorContext(ctx, "Unsubscribe failed to complete successfully", args...)
return
}
lm.logger.Info("Unsubscribe completed successfully", args...)
Expand Down
2 changes: 1 addition & 1 deletion consumers/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var (
func Start(ctx context.Context, id string, sub messaging.Subscriber, consumer interface{}, configPath string, logger *slog.Logger) error {
cfg, err := loadConfig(configPath)
if err != nil {
logger.Error(fmt.Sprintf("Failed to load consumer config: %s", err))
logger.Warn(fmt.Sprintf("Failed to load consumer config: %s", err))
}

transformer := makeTransformer(cfg.TransformerCfg, logger)
Expand Down
2 changes: 1 addition & 1 deletion ws/api/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (lm *loggingMiddleware) Subscribe(ctx context.Context, thingKey, chanID, su
}
if err != nil {
args = append(args, slog.Any("error", err))
lm.logger.Error("Subscibe failed to complete successfully", args...)
lm.logger.ErrorContext(ctx, "Subscibe failed to complete successfully", args...)
return
}
lm.logger.Info("Subscribe completed successfully", args...)
Expand Down

0 comments on commit e6b8974

Please sign in to comment.