0f8e0dd8fa
debug及trlog采用文件夹归类
19 lines
386 B
Python
19 lines
386 B
Python
import datetime
|
|
import os
|
|
def gettm():
|
|
t= datetime.datetime.now()
|
|
d = str(t)
|
|
return d,d[:10]
|
|
|
|
def save2file(data,isR=1):
|
|
# pass
|
|
t,d = gettm()
|
|
|
|
p = '/'.join(['trlog',d])
|
|
if not os.path.exists(p):
|
|
os.makedirs(p)
|
|
|
|
l=f"{'[R]' if isR else '[T]'} - {t} --- {data.hex(' ')}\n"
|
|
f=open('/'.join(['trlog',d,'trlog.txt']),'a')
|
|
f.write(l)
|
|
f.close |