Merge pull request #539 from archlinux/torxed-improve-logging
Adding --debug and other log enhancements
This commit is contained in:
commit
2731f82d0f
|
|
@ -61,6 +61,10 @@ def initialize_arguments():
|
||||||
|
|
||||||
|
|
||||||
arguments = initialize_arguments()
|
arguments = initialize_arguments()
|
||||||
|
storage['arguments'] = arguments
|
||||||
|
if arguments.get('debug'):
|
||||||
|
log(f"Warning: --debug mode will write certain credentials to {storage['LOG_PATH']}/{storage['LOG_FILE']}!", fg="red", level=logging.WARNING)
|
||||||
|
|
||||||
from .lib.plugins import plugins, load_plugin # This initiates the plugin loading ceremony
|
from .lib.plugins import plugins, load_plugin # This initiates the plugin loading ceremony
|
||||||
|
|
||||||
if arguments.get('plugin', None):
|
if arguments.get('plugin', None):
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ from typing import Union
|
||||||
|
|
||||||
from .exceptions import *
|
from .exceptions import *
|
||||||
from .output import log
|
from .output import log
|
||||||
|
from .storage import storage
|
||||||
|
|
||||||
def gen_uid(entropy_length=256):
|
def gen_uid(entropy_length=256):
|
||||||
return hashlib.sha512(os.urandom(entropy_length)).hexdigest()
|
return hashlib.sha512(os.urandom(entropy_length)).hexdigest()
|
||||||
|
|
@ -265,6 +265,8 @@ class SysCommandWorker:
|
||||||
if not self.pid:
|
if not self.pid:
|
||||||
try:
|
try:
|
||||||
os.execve(self.cmd[0], self.cmd, {**os.environ, **self.environment_vars})
|
os.execve(self.cmd[0], self.cmd, {**os.environ, **self.environment_vars})
|
||||||
|
if storage['arguments'].get('debug'):
|
||||||
|
log(f"Executing: {self.cmd}", level=logging.DEBUG)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
log(f"{self.cmd[0]} does not exist.", level=logging.ERROR, fg="red")
|
log(f"{self.cmd[0]} does not exist.", level=logging.ERROR, fg="red")
|
||||||
self.exit_code = 1
|
self.exit_code = 1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue