-
Notifications
You must be signed in to change notification settings - Fork 1
/
log.py
49 lines (31 loc) · 751 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# -*- coding: utf-8 -*-
"""
Created on Fri May 18 10:58:20 2018
@author: Kai Qin
"""
import time
testTag = 'results: '
def debug_test(mes):
print(testTag + str(mes))
def info_test(mes):
print(testTag + str(mes))
def debug_tag(tag, mes):
print(tag + ': ' + str(mes))
def info_tag(tag, mes):
print(tag + ': ' + str(mes))
def get_time():
return time.time()
def time_diff_tag(tag, t1, t2):
dif = round(t2 - t1, 4)
print(tag, ':', dif, 's')
return dif
def time_diff(t1, t2):
dif = round(t2 - t1, 4)
return dif
def time_diff_now(tag, startTime):
if startTime is None:
return
endTime = time.time()
dif = round(endTime - startTime, 4)
print(tag + ':', dif, 's')
return dif