tt-server/s2f.py
CSSC-WORK\murmur 0f8e0dd8fa 添加缓存机制,处理粘包
debug及trlog采用文件夹归类
2024-01-23 18:33:35 +08:00

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