dynamic debug logging

This commit is contained in:
Usman Nasir
2020-01-27 19:27:44 +05:00
parent 157ae0dab3
commit ddbea34164

View File

@@ -9,6 +9,7 @@ import getpass
import codecs import codecs
class ProcessUtilities(multi.Thread): class ProcessUtilities(multi.Thread):
debugPath = '/home/cyberpanel/debug'
litespeedProcess = "litespeed" litespeedProcess = "litespeed"
ent = 1 ent = 1
OLS = 0 OLS = 0
@@ -187,12 +188,14 @@ class ProcessUtilities(multi.Thread):
sock = ret[0] sock = ret[0]
if user == None: if user == None:
#logging.writeToFile(ProcessUtilities.token + command) if os.path.exists(ProcessUtilities.debugPath):
logging.writeToFile(ProcessUtilities.token + command)
sock.sendall((ProcessUtilities.token + command).encode('utf-8')) sock.sendall((ProcessUtilities.token + command).encode('utf-8'))
else: else:
command = '%s-u %s %s' % (ProcessUtilities.token, user, command) command = '%s-u %s %s' % (ProcessUtilities.token, user, command)
command = command.replace('sudo', '') command = command.replace('sudo', '')
#logging.writeToFile(command) if os.path.exists(ProcessUtilities.debugPath):
logging.writeToFile(command)
sock.sendall(command.encode('utf-8')) sock.sendall(command.encode('utf-8'))
data = "" data = ""