diff options
author | Saptak Sengupta <saptak013@gmail.com> | 2021-04-13 02:45:12 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-13 02:45:12 +0530 |
commit | 530f9547f5ac28e68e83ed827d334f66de99bdc4 (patch) | |
tree | eb54302d6d4a46704639651d26579708106a4a21 /cli/onionshare_cli | |
parent | e01c72b6a0612f1a53c91543b734328f62ee4973 (diff) | |
parent | 5cf8ef180eed6fa2cf49502eb3ccd6d308269ae4 (diff) | |
download | onionshare-530f9547f5ac28e68e83ed827d334f66de99bdc4.tar.gz onionshare-530f9547f5ac28e68e83ed827d334f66de99bdc4.zip |
Merge pull request #1326 from micahflee/pretty_verbose
Make verbose output prettier with terminal colors
Diffstat (limited to 'cli/onionshare_cli')
-rw-r--r-- | cli/onionshare_cli/common.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cli/onionshare_cli/common.py b/cli/onionshare_cli/common.py index 4cfe83ae..e812aa98 100644 --- a/cli/onionshare_cli/common.py +++ b/cli/onionshare_cli/common.py @@ -43,6 +43,10 @@ class Common: The Common object is shared amongst all parts of OnionShare. """ + C_RESET = "\033[0m" + C_LIGHTGRAY = "\033[37m" + C_DARKGRAY = "\033[90m" + def __init__(self, verbose=False): self.verbose = verbose @@ -68,10 +72,9 @@ class Common: """ if self.verbose: timestamp = time.strftime("%b %d %Y %X") - - final_msg = f"[{timestamp}] {module}.{func}" + final_msg = f"{self.C_DARKGRAY}[{timestamp}]{self.C_RESET} {self.C_LIGHTGRAY}{module}.{func}{self.C_RESET}" if msg: - final_msg = f"{final_msg}: {msg}" + final_msg = f"{final_msg}{self.C_LIGHTGRAY}: {msg}{self.C_RESET}" print(final_msg) def get_resource_path(self, filename): |