Skip to content

Commit

Permalink
replace userid with 'unknown-user' in traces, that is not meaningful,…
Browse files Browse the repository at this point in the history
… and not in the json output either
  • Loading branch information
parmentelat committed Jun 3, 2020
1 parent 8ad404b commit c9bc8bc
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion nbautoeval/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ def _log2_path():
def _storage_path():
return _log_path().with_suffix(".storage")

# historically for each attempt we stored in
# ~/.nbautoeval
# a line with
# <date> <userid> <exoname> <details...>
# with details depending on the kind of exercise
# * functions get a OK/KO, while
# * quizzes get details on the grade
# because this format has grown fragile it is recommended to read
# ~/.nbautoeval.trace instead,
# which has the same info but in JSON format
# now, for compatibility we still store the old format
# but the way to compute this <userid> thingy is fragile too
# and it is no longer exposed in the json output anyway
# so from 1.1.6 we just write 'unknown-user' instead of userid

# ----------
# first-generation logging - for exercises initially
Expand All @@ -47,7 +61,7 @@ def _log_line(exoname, message):
"""
try:
now = time.strftime("%D-%H:%M", time.localtime())
uid = os.getlogin()
uid = 'unknown-user'
with _log_path().open('a') as log:
line = f"{now} {uid} {exoname} {message}\n"
log.write(line)
Expand Down

0 comments on commit c9bc8bc

Please sign in to comment.