Skip to content

Commit

Permalink
fix: re-add context info to auditlog
Browse files Browse the repository at this point in the history
  • Loading branch information
FreddyDevelop committed Nov 12, 2024
1 parent 86b4cea commit 5b84cc0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
3 changes: 0 additions & 3 deletions backend/audit_log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ func (l *logger) logToConsole(auditLog models.AuditLog) {
}

func (l *logger) getRequestMeta(c echo.Context) models.RequestMeta {
if c == nil {
return models.RequestMeta{}
}
return models.RequestMeta{
HttpRequestId: c.Response().Header().Get(echo.HeaderXRequestID),
UserAgent: c.Request().UserAgent(),
Expand Down
2 changes: 1 addition & 1 deletion backend/handler/session_admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (h *SessionAdminHandler) Generate(ctx echo.Context) error {
SessionToken: encodedToken,
}

err = h.auditLogger.Create(nil, models.AuditLogLoginSuccess, user, nil, auditlog.Detail("api", "admin"))
err = h.auditLogger.Create(ctx, models.AuditLogLoginSuccess, user, nil, auditlog.Detail("api", "admin"))
if err != nil {
return fmt.Errorf("could not create audit log: %w", err)
}
Expand Down

0 comments on commit 5b84cc0

Please sign in to comment.