forked from Bhashini-IITJ/visualTranslation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
35 lines (27 loc) · 810 Bytes
/
utils.py
File metadata and controls
35 lines (27 loc) · 810 Bytes
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
from datetime import datetime
PrintColor = {
'black': 30,
'red': 31,
'green': 32,
'yellow': 33,
'blue': 34,
'amaranth': 35,
'ultramarine': 36,
'white': 37
}
PrintStyle = {
'default': 0,
'highlight': 1,
'underline': 4,
'flicker': 5,
'inverse': 7,
'invisible': 8
}
def get_train_name():
return datetime.now().strftime('%Y%m%d%H%M%S')
def print_log(s, time_style = PrintStyle['default'], time_color = PrintColor['blue'],
content_style = PrintStyle['default'], content_color = PrintColor['white']):
cur_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]
log = '\033[{};{}m[{}]\033[0m \033[{};{}m{}\033[0m'.format \
(time_style, time_color, cur_time, content_style, content_color, s)
print(log)