[DEV] naming error
This commit is contained in:
parent
c962b4fb9f
commit
f069299a53
114
lutin/debug.py
114
lutin/debug.py
@ -11,8 +11,8 @@ import os
|
|||||||
import threading
|
import threading
|
||||||
import re
|
import re
|
||||||
|
|
||||||
debugLevel=3
|
debug_level=3
|
||||||
debugColor=False
|
debug_color=False
|
||||||
|
|
||||||
color_default= ""
|
color_default= ""
|
||||||
color_red = ""
|
color_red = ""
|
||||||
@ -23,20 +23,20 @@ color_purple = ""
|
|||||||
color_cyan = ""
|
color_cyan = ""
|
||||||
|
|
||||||
|
|
||||||
debugLock = threading.Lock()
|
debug_lock = threading.Lock()
|
||||||
|
|
||||||
def set_level(id):
|
def set_level(id):
|
||||||
global debugLevel
|
global debug_level
|
||||||
debugLevel = id
|
debug_level = id
|
||||||
#print "SetDebug level at " + str(debugLevel)
|
#print "SetDebug level at " + str(debug_level)
|
||||||
|
|
||||||
def get_level():
|
def get_level():
|
||||||
global debugLevel
|
global debug_level
|
||||||
return debugLevel
|
return debug_level
|
||||||
|
|
||||||
def enable_color():
|
def enable_color():
|
||||||
global debugColor
|
global debug_color
|
||||||
debugColor = True
|
debug_color = True
|
||||||
global color_default
|
global color_default
|
||||||
color_default= "\033[00m"
|
color_default= "\033[00m"
|
||||||
global color_red
|
global color_red
|
||||||
@ -53,8 +53,8 @@ def enable_color():
|
|||||||
color_cyan = "\033[36m"
|
color_cyan = "\033[36m"
|
||||||
|
|
||||||
def disable_color():
|
def disable_color():
|
||||||
global debugColor
|
global debug_color
|
||||||
debugColor = True
|
debug_color = True
|
||||||
global color_default
|
global color_default
|
||||||
color_default= ""
|
color_default= ""
|
||||||
global color_red
|
global color_red
|
||||||
@ -71,67 +71,67 @@ def disable_color():
|
|||||||
color_cyan = ""
|
color_cyan = ""
|
||||||
|
|
||||||
def extreme_verbose(input, force=False):
|
def extreme_verbose(input, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 6 \
|
if debug_level >= 6 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(color_blue + input + color_default)
|
print(color_blue + input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def verbose(input, force=False):
|
def verbose(input, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 5 \
|
if debug_level >= 5 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(color_blue + input + color_default)
|
print(color_blue + input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def debug(input, force=False):
|
def debug(input, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 4 \
|
if debug_level >= 4 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(color_green + input + color_default)
|
print(color_green + input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def info(input, force=False):
|
def info(input, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 3 \
|
if debug_level >= 3 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(input + color_default)
|
print(input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def warning(input, force=False):
|
def warning(input, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 2 \
|
if debug_level >= 2 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(color_purple + "[WARNING] " + input + color_default)
|
print(color_purple + "[WARNING] " + input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def todo(input, force=False):
|
def todo(input, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 3 \
|
if debug_level >= 3 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(color_purple + "[TODO] " + input + color_default)
|
print(color_purple + "[TODO] " + input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def error(input, thread_id=-1, force=False, crash=True):
|
def error(input, thread_id=-1, force=False, crash=True):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 1 \
|
if debug_level >= 1 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(color_red + "[ERROR] " + input + color_default)
|
print(color_red + "[ERROR] " + input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
if crash == True:
|
if crash == True:
|
||||||
from . import multiprocess
|
from . import multiprocess
|
||||||
multiprocess.set_error_occured()
|
multiprocess.set_error_occured()
|
||||||
@ -142,18 +142,18 @@ def error(input, thread_id=-1, force=False, crash=True):
|
|||||||
#raise "error happend"
|
#raise "error happend"
|
||||||
|
|
||||||
def print_element(type, lib, dir, name, force=False):
|
def print_element(type, lib, dir, name, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 3 \
|
if debug_level >= 3 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(color_cyan + type + color_default + " : " + color_yellow + lib + color_default + " " + dir + " " + color_blue + name + color_default)
|
print(color_cyan + type + color_default + " : " + color_yellow + lib + color_default + " " + dir + " " + color_blue + name + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def print_compilator(myString):
|
def print_compilator(myString):
|
||||||
global debugColor
|
global debug_color
|
||||||
global debugLock
|
global debug_lock
|
||||||
if debugColor == True:
|
if debug_color == True:
|
||||||
myString = myString.replace('\\n', '\n')
|
myString = myString.replace('\\n', '\n')
|
||||||
myString = myString.replace('\\t', '\t')
|
myString = myString.replace('\\t', '\t')
|
||||||
myString = myString.replace('error:', color_red+'error:'+color_default)
|
myString = myString.replace('error:', color_red+'error:'+color_default)
|
||||||
@ -163,9 +163,9 @@ def print_compilator(myString):
|
|||||||
myString = myString.replace('-COLORIN-', color_yellow)
|
myString = myString.replace('-COLORIN-', color_yellow)
|
||||||
myString = myString.replace('-COLOROUT-', color_default)
|
myString = myString.replace('-COLOROUT-', color_default)
|
||||||
|
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(myString)
|
print(myString)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def get_color_set() :
|
def get_color_set() :
|
||||||
global color_default
|
global color_default
|
||||||
|
Loading…
x
Reference in New Issue
Block a user