mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Better logging
This commit is contained in:
parent
b9e754a6bb
commit
52cf14de7e
@ -69,3 +69,5 @@ If you didn't install Maloja from the package (and therefore don't have it in `/
|
||||
maloja restart
|
||||
maloja start
|
||||
maloja update
|
||||
|
||||
The `update` command will always fetch the latest version, while packages are only offered for release versions.
|
||||
|
@ -4,6 +4,7 @@ import hashlib
|
||||
from threading import Thread
|
||||
import pickle
|
||||
import urllib
|
||||
import datetime
|
||||
|
||||
|
||||
### TSV files
|
||||
@ -160,11 +161,12 @@ def cleandict(d):
|
||||
|
||||
def log(msg):
|
||||
import inspect
|
||||
now = datetime.datetime.utcnow().strftime("%Y/%m/%d %H:%M:%S")
|
||||
module = inspect.getmodule(inspect.stack()[1][0]).__name__
|
||||
if module == "__main__": module = "mainserver"
|
||||
print("[" + module + "] " + msg)
|
||||
with open("logs/" + module + ".log","a") as logfile:
|
||||
logfile.write(msg + "\n")
|
||||
logfile.write(now + " " + msg + "\n")
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user