Skip to content

Commit 8e68f9f

Browse files
onahprospersundayonah
authored andcommitted
feat: enhance logging with contextual information across services (#459)
* Enhance logging with contextual information across services - Updated logging in `priority_queue.go` to include additional context such as Redis keys, provider IDs, and error details for better traceability. - Improved error handling in `tasks.go` by adding more descriptive logging for RPC client connections, order operations, and refund processes. - Enhanced the logger utility in `logger.go` to automatically include caller information (file, line, function) in log entries for easier debugging. - Refined error logging in `utils.go` to provide more context when invalid provider data is encountered, including token and currency details. * fix(logger): enhance logging with caller information and improve error context for indexer * Refactor error logging to use fmt.Sprintf for consistent error formatting - Updated error logging across multiple services to use fmt.Sprintf for better error message formatting. - Ensured all error messages include detailed context for easier debugging. - Adjusted tests to accommodate changes in error handling. * fix(auth): update logging to use UserID instead of Email for errors logging * fix(logger): update log field keys to use PascalCase for consistency * fix(logger): update OrderID logging to use hex encoding for consistency
1 parent c1cc1f5 commit 8e68f9f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

controllers/accounts/auth.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,17 @@ func (ctrl *AuthController) Register(ctx *gin.Context) {
262262
sender, err := senderCreate.Save(ctx)
263263
if err != nil {
264264
_ = tx.Rollback()
265+
<<<<<<< HEAD
265266
logger.Errorf("error: %v", err)
266267
u.APIResponse(ctx, http.StatusInternalServerError, "error", "Failed to create new user", nil)
268+
=======
269+
logger.WithFields(logger.Fields{
270+
"Error": fmt.Sprintf("%v", err),
271+
"UserID": user.ID,
272+
}).Errorf("Failed to create sender profile")
273+
u.APIResponse(ctx, http.StatusInternalServerError, "error",
274+
"Failed to create new user", nil)
275+
>>>>>>> 088148e (feat: enhance logging with contextual information across services (#459))
267276
return
268277
}
269278

0 commit comments

Comments
 (0)