Wallet config debugging. More.

This commit is contained in:
empresa 2025-09-09 23:55:30 +07:00
parent 07134d26d7
commit 7ff426f9ba
1 changed files with 12 additions and 0 deletions

View File

@ -20,22 +20,34 @@ class logger:
GREEN = '\033[92m' GREEN = '\033[92m'
BLUE = '\033[94m' BLUE = '\033[94m'
RESET = '\033[0m' RESET = '\033[0m'
LOG_FILE = '/opt/clore-hosting/clore_onboarding.log'
@staticmethod @staticmethod
def _get_current_time(): def _get_current_time():
return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
@staticmethod
def _log_to_file(level, message):
try:
with open(logger.LOG_FILE, 'a') as f:
f.write(f"{logger._get_current_time()} | {level} | {message}\n")
except Exception:
pass
@staticmethod @staticmethod
def error(message): def error(message):
print(f"{logger.RED}{logger._get_current_time()} | ERROR | {message}{logger.RESET}") print(f"{logger.RED}{logger._get_current_time()} | ERROR | {message}{logger.RESET}")
logger._log_to_file("ERROR", message)
@staticmethod @staticmethod
def success(message): def success(message):
print(f"{logger.GREEN}{logger._get_current_time()} | SUCCESS | {message}{logger.RESET}") print(f"{logger.GREEN}{logger._get_current_time()} | SUCCESS | {message}{logger.RESET}")
logger._log_to_file("SUCCESS", message)
@staticmethod @staticmethod
def info(message): def info(message):
print(f"{logger.BLUE}{logger._get_current_time()} | INFO | {message}{logger.RESET}") print(f"{logger.BLUE}{logger._get_current_time()} | INFO | {message}{logger.RESET}")
logger._log_to_file("INFO", message)
if os.geteuid() != 0: if os.geteuid() != 0:
logger.error("This script must be run as root!") logger.error("This script must be run as root!")