-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.py
31 lines (23 loc) · 783 Bytes
/
log.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# secure multi-party computation, semi-honest case, distributed, v1
# naranker dulay, dept of computing, imperial college, october 2020
# Radovan, [email protected], November 2020
# Jamie Salter, [email protected], November 2020
from config import VERBOSE
# ---------------------------------------------------------------------------
party_no = 0
line = 0
def init_logging(_party_no):
global party_no, line
party_no = _party_no
line = 0
def write(message):
global party_no, line
line += 1
print(f'{party_no:02}-{line:03}: {message}')
def debug(message, verbose=1):
global party_no, line
line += 1
if VERBOSE >= verbose:
print(f'{party_no:02}-{line:03}: {message}')
def dsort(dict): # dictionary sorted on key
return {k: v for (k,v) in sorted(dict.items())}