diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-08-04 15:26:49 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-08-04 15:26:49 -0300 |
commit | 27c66ba593683aa167d364964b5385b9a0d0bdd8 (patch) | |
tree | 3afec735589c26272e28acef0e79f8370fa5b392 /server.py | |
parent | 00b6b129f1848613404ead84ef2754fd1f614b8a (diff) | |
download | server-27c66ba593683aa167d364964b5385b9a0d0bdd8.tar.gz server-27c66ba593683aa167d364964b5385b9a0d0bdd8.tar.bz2 server-27c66ba593683aa167d364964b5385b9a0d0bdd8.tar.xz server-27c66ba593683aa167d364964b5385b9a0d0bdd8.zip |
Add another verbosity level, otherwise debug.txt will be a monster
Diffstat (limited to 'server.py')
-rwxr-xr-x | server.py | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -54,8 +54,8 @@ class WebSocketConn(WebSocket): print("Message received from %s - %s" % (self.address[0], self.data)) try: r=protocol.parse(self.data, self) - print("Status: %s" % str(r[0])) - print("Reply: %s" % r[1]) + stdout("Status: %s" % str(r[0]), 2) + stdout("Reply: %s" % r[1], 2) if r[0] < PACKET_ACK: stdout("%s - %s" % (self.address[0], r[1])) syslog.syslog(LOG_AUTH, "%s - %s" % (self.address[0], r[1])) @@ -67,7 +67,7 @@ class WebSocketConn(WebSocket): traceback.print_exc() self.send_message("ERROR\n") - print("Message sent") + stdout("Message sent", 2) #stdout(self.address[0] + u' - %s' % (self.data)) #self.send_message('ACK') @@ -127,7 +127,7 @@ class WebSocketConn(WebSocket): player.clear(self.token) except: traceback.print_exc() - stdout("Error at player.clear") + stdout("Error at player.clear", 0) ########################## # Useful functions: @@ -179,7 +179,7 @@ def disconnect(ip): ############################################################### # Begin stuff -stdout("Starting at: T-%d" % (now())) +stdout("Starting at: T-%d" % (now()), 0) syslog.openlog() MainWebsocket() try: @@ -218,8 +218,11 @@ try: sendmsg("NOTICE:Server is going down for scheduled maintenance. Please close, wait five minutes, and then re-open the app.") break elif cmd in ["dbg", "debug"]: - debug = not debug - stdout("Changed debug mode to %s" % str(debug)) + if debug == 2: + debug = 0 + else: + debug += 1 + stdout("Changed debug mode to %d" % debug) elif cmd in ["raw", "eval"] and debug: try: print(eval(com)) @@ -259,7 +262,7 @@ try: else: stdout("ERROR: Unknown command.") except: - stdout("Abrupt error: Terminating!") + stdout("Abrupt error: Terminating!", 0) traceback.print_exc() # Wait a bit before disconnecting all clients |