-
Notifications
You must be signed in to change notification settings - Fork 3
/
babylog.py
39 lines (24 loc) · 788 Bytes
/
babylog.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
# Super small logging utility, maintains a log file.
from datetime import datetime as dt
def tstamp():
return str(dt.now()).split('.')[0]
def log2file(timestamp,flag,message):
with open('miner.log','a') as f:
sep='\t'
print(timestamp,sep,flag,sep,message,file=f)
def start():
with open('miner.log','a') as f:
print('\n',r' //\(oo)/\\ //\(oo)/\\ //\(oo)/\\',file=f)
log2file(tstamp(),'BOOT','Started Dockerized mini miner')
def status(msg):
log2file(tstamp(),'STAT',msg)
def warn(msg):
log2file(tstamp(),'WARN',msg)
def error(msg):
log2file(tstamp(),'ERR_',msg)
def fubar(msg):
log2file(tstamp(),'FUCK',msg)
def stop(msg):
log2file(tstamp(),'STOP',msg)
if __name__ == "__main__":
start()