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