summaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/utils.py b/utils.py
index c4f94c4..447eef9 100644
--- a/utils.py
+++ b/utils.py
@@ -21,8 +21,11 @@
import time, hashlib, datetime, uuid
import json, zlib, base64
-# Be verbose
-debug=True
+# Set server debug level
+# 0 - Production/Stable, Silent
+# 1 - Production/Unstable
+# 2 - Development/Debug
+debug=1
# Create a variable called "salt", which contains the token saltening sequence
s=open("salt.txt", "r")
@@ -77,8 +80,8 @@ def date_from_now():
def stdout(mx, verbose=1):
- print(mx)
if (debug >= verbose):
+ print(mx)
dfile=open("debug.txt", 'a')
dt=datetime.datetime.now().timetuple()
date="[%04d-%02d-%02d %02d:%02d:%02d]" % (dt[0], dt[1], dt[2], dt[3], dt[4], dt[5])
@@ -86,13 +89,13 @@ def stdout(mx, verbose=1):
dfile.close()
def compress(string):
- stdout("Compress: Received JSON data: %s" % (string))
+ stdout("Compress: Received JSON data: %s" % (string), 1)
sjs=json.dumps(string)
sjs=sjs.encode("ascii")
sjs=zlib.compress(sjs)
sjs=base64.b64encode(sjs)
sjs=sjs.decode("ascii")
- stdout("Compress: Sending base64+zlib JSON ASCII data: %s" % (sjs))
+ stdout("Compress: Sending base64+zlib JSON ASCII data: %s" % (sjs), 2)
return sjs
# Search for array[?][key]==search in an array of dicts