Skip to content

Commit

Permalink
Added time to console outputs.
Browse files Browse the repository at this point in the history
  • Loading branch information
bennyscripts committed Oct 27, 2024
1 parent f07c188 commit ef965e6
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions utils/console.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import colorama
import datetime
import os, sys, pystyle

from . import config
Expand All @@ -15,6 +16,9 @@ def resize(columns, rows):
else:
os.system(f"echo '\033[8;{rows};{columns}t'")

def get_formatted_time():
return datetime.datetime.now().strftime("%H:%M:%S")

def print_banner():
copyright_ = f"( Ghost v{config.VERSION} )"
banner = f""" ██████╗ ██╗ ██╗ ██████╗ ███████╗████████╗
Expand Down Expand Up @@ -47,19 +51,19 @@ def print_color(color, text):
print(color + text + colorama.Style.RESET_ALL)

def print_cmd(text):
print(f"{colorama.Fore.LIGHTBLUE_EX}{colorama.Style.BRIGHT}[COMMAND]{colorama.Style.RESET_ALL} {text}")
print(f"{colorama.Fore.LIGHTBLACK_EX}[{get_formatted_time()}] {colorama.Fore.LIGHTBLUE_EX}{colorama.Style.BRIGHT}[COMMAND]{colorama.Style.RESET_ALL} {text}")

def print_info(text):
print(f"{colorama.Fore.LIGHTGREEN_EX}{colorama.Style.BRIGHT}[INFO]{colorama.Style.RESET_ALL} {text}")
print(f"{colorama.Fore.LIGHTBLACK_EX}[{get_formatted_time()}] {colorama.Fore.LIGHTGREEN_EX}{colorama.Style.BRIGHT}[INFO]{colorama.Style.RESET_ALL} {text}")

def print_success(text):
print(f"{colorama.Fore.LIGHTGREEN_EX}{colorama.Style.BRIGHT}[SUCCESS]{colorama.Style.RESET_ALL} {text}")
print(f"{colorama.Fore.LIGHTBLACK_EX}[{get_formatted_time()}] {colorama.Fore.LIGHTGREEN_EX}{colorama.Style.BRIGHT}[SUCCESS]{colorama.Style.RESET_ALL} {text}")

def print_error(text):
print(f"{colorama.Fore.LIGHTRED_EX}{colorama.Style.BRIGHT}[ERROR]{colorama.Style.RESET_ALL} {text}")
print(f"{colorama.Fore.LIGHTBLACK_EX}[{get_formatted_time()}] {colorama.Fore.LIGHTRED_EX}{colorama.Style.BRIGHT}[ERROR]{colorama.Style.RESET_ALL} {text}")

def print_warning(text):
print(f"{colorama.Fore.LIGHTYELLOW_EX}{colorama.Style.BRIGHT}[WARNING]{colorama.Style.RESET_ALL} {text}")
print(f"{colorama.Fore.LIGHTBLACK_EX}[{get_formatted_time()}] {colorama.Fore.LIGHTYELLOW_EX}{colorama.Style.BRIGHT}[WARNING]{colorama.Style.RESET_ALL} {text}")

def print_cli(text):
print(f"{colorama.Fore.LIGHTMAGENTA_EX}{colorama.Style.BRIGHT}[CLI]{colorama.Style.RESET_ALL} {text}")
print(f"{colorama.Fore.LIGHTBLACK_EX}[{get_formatted_time()}] {colorama.Fore.LIGHTMAGENTA_EX}{colorama.Style.BRIGHT}[CLI]{colorama.Style.RESET_ALL} {text}")

0 comments on commit ef965e6

Please sign in to comment.