mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
colors for debugging
This commit is contained in:
12
debug.py
12
debug.py
@@ -1,4 +1,12 @@
|
||||
import inspect
|
||||
try:
|
||||
from colorama import Fore, init
|
||||
init()
|
||||
except ImportError:
|
||||
class Fore(object):
|
||||
RED = ''
|
||||
GREEN = ''
|
||||
RESET = ''
|
||||
|
||||
NOTICE = object()
|
||||
WARNING = object()
|
||||
@@ -25,8 +33,8 @@ def error(*args):
|
||||
|
||||
def print_to_stdout(level, *args):
|
||||
""" The default debug function """
|
||||
print(('dbg: ' if level == NOTICE else 'warning: ') +
|
||||
', '.join(str(a) for a in args))
|
||||
msg = (Fore.GREEN + 'dbg: ' if level == NOTICE else Fore.RED + 'warning: ')
|
||||
print(msg + ', '.join(str(a) for a in args) + Fore.RESET)
|
||||
|
||||
|
||||
debug_function = None
|
||||
|
||||
Reference in New Issue
Block a user