File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -144,6 +144,9 @@ del_*.ps1
144144# VSCode stuff.
145145.vscode
146146
147+ # Custom debug log
148+ ocsi_dbg_log *
149+
147150# MacOS bundling tests
148151* .dmg
149152* .app
Original file line number Diff line number Diff line change 44the UI functions.
55"""
66import json
7- import platform
87import os
8+ import platform
9+ import re
910import sys
10- import requests
1111
1212dir_delim = "\\ " if platform .system ().lower () == "windows" else "/"
1313
@@ -72,13 +72,22 @@ def color_text(text, color):
7272def format_text (text , formatting ):
7373 formatting_list = formatting .split ("+" )
7474 final_string = text
75+
7576 for format in formatting_list :
7677 format_var = globals ().get (format ) if globals ().get (format ) else None
78+
7779 if format_var :
7880 final_string = f"{ format_var } { final_string } "
81+
7982 final_string += end_formatting
83+
8084 return final_string
8185
86+ def clear_ansi (text ):
87+ ansi_escape = re .compile (r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])' )
88+
89+ return ansi_escape .sub ('' , text )
90+
8291surprise = f"""{ cyan }
8392 __ __ ______ _ _____ _
8493 \ \ / / | ____| | | |_ _| |
Original file line number Diff line number Diff line change 1+ import os
2+
3+ from src .info import AppInfo , clear_ansi
4+
5+
16class DebuggerInst ():
27 def __init__ (self ):
38 self .debug = None
9+ self .file = os .path .join (
10+ AppInfo .root_dir ,
11+ 'ocsi_dbg_log.txt'
12+ )
413
514 def log_dbg (self , contents = "\n " ):
615 if not self .debug :
716 return
17+
18+ if self .file :
19+ with open (self .file , 'a' ) as file :
20+ file .write (clear_ansi (contents ) + "\n " )
21+ file .close ()
822
923 print (contents )
1024
You can’t perform that action at this time.
0 commit comments