mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
new: integrated python standard logger (closes #84)
This commit is contained in:
@ -1,24 +1,7 @@
|
||||
import sys
|
||||
import glob
|
||||
import os
|
||||
import time
|
||||
import subprocess
|
||||
from threading import Lock
|
||||
from datetime import datetime
|
||||
|
||||
logfile = None
|
||||
loglock = Lock()
|
||||
|
||||
|
||||
def log(msg):
|
||||
tstamp = str(datetime.now())
|
||||
line = "[%s] %s" % (tstamp, msg.rstrip())
|
||||
print(line)
|
||||
sys.stdout.flush()
|
||||
if logfile is not None:
|
||||
with loglock:
|
||||
with open(logfile, 'a+t') as fp:
|
||||
fp.write("%s\n" % line)
|
||||
|
||||
|
||||
def secs_to_hhmmss(secs):
|
||||
|
Reference in New Issue
Block a user