19arjun89 commited on
Commit
d329207
·
verified ·
1 Parent(s): ae85fb5

Update usage_logging.py

Browse files
Files changed (1) hide show
  1. usage_logging.py +4 -1
usage_logging.py CHANGED
@@ -123,7 +123,7 @@ def _country_lookup(ip: str) -> str:
123
  return "Unknown"
124
 
125
 
126
- def append_visit_to_dataset(country: str, city: str, event_type: str = "usage_start"):
127
  api = _hf_api()
128
  if not api:
129
  return
@@ -141,6 +141,9 @@ def append_visit_to_dataset(country: str, city: str, event_type: str = "usage_st
141
  "event": event_type,
142
  }
143
 
 
 
 
144
  new_content = (
145
  existing.rstrip("\n") + "\n"
146
  if existing.strip()
 
123
  return "Unknown"
124
 
125
 
126
+ def append_visit_to_dataset(country: str, city: str, event_type: str = "usage_start", **extra_fields):
127
  api = _hf_api()
128
  if not api:
129
  return
 
141
  "event": event_type,
142
  }
143
 
144
+ if extra_fields:
145
+ event.update(extra_fields)
146
+
147
  new_content = (
148
  existing.rstrip("\n") + "\n"
149
  if existing.strip()