Skip to content

Commit

Permalink
Add date/time timestamp to saved metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ibazulic committed Oct 1, 2024
1 parent 0136360 commit f861ff4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions endpoints/api/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,12 @@ def _queue_logs_export(start_time, end_time, options, namespace_name, repository


def _log_export_success(user_or_org_name, repository, export_id, request, kind):
if kind == "reposiotory":
if kind == "repo":
log_action(
"export_logs_success",
user_or_org_name,
{
"date/time": datetime.utcnow(),
"repo": repository,
"export_id": export_id,
"url": request.get_json().get("callback_url") or None,
Expand All @@ -371,17 +372,19 @@ def _log_export_success(user_or_org_name, repository, export_id, request, kind):
"export_logs_success",
user_or_org_name,
{
"date/time": datetime.utcnow(),
"export_id": export_id,
"url": request.get_json().get("callback_url") or None,
"email": request.get_json().get("callback_email") or None,
},
)

if kind == "organization":
if kind == "org":
log_action(
"export_logs_success",
user_or_org_name,
{
"date/time": datetime.utcnow(),
"export_id": export_id,
"url": request.get_json().get("callback_url") or None,
"email": request.get_json().get("callback_email") or None,
Expand All @@ -395,6 +398,7 @@ def _log_export_failure(user_or_org_name, repository, request, ex, kind):
"export_logs_failure",
user_or_org_name,
{
"date/time": datetime.utcnow(),
"repo": repository,
"error": ex,
"url": request.get_json().get("callback_url") or None,
Expand All @@ -407,6 +411,7 @@ def _log_export_failure(user_or_org_name, repository, request, ex, kind):
"export_logs_failure",
user_or_org_name,
{
"date/time": datetime.utcnow(),
"error": ex,
"url": request.get_json().get("callback_url") or None,
"email": request.get_json().get("callback_email") or None,
Expand All @@ -418,6 +423,7 @@ def _log_export_failure(user_or_org_name, repository, request, ex, kind):
"export_logs_failure",
user_or_org_name,
{
"date/time": datetime.utcnow(),
"error": ex,
"url": request.get_json().get("callback_url") or None,
"email": request.get_json().get("callback_email") or None,
Expand Down

0 comments on commit f861ff4

Please sign in to comment.