Make level optional argument
This commit is contained in:
parent
3c65bc05b8
commit
aa7097e264
@ -13,7 +13,7 @@ class bcolors:
|
||||
BOLD = '\033[1m'
|
||||
UNDERLINE = '\033[4m'
|
||||
|
||||
def log(level, message, thread="", detail=True, write=True):
|
||||
def log(message, level="i", thread="", detail=True, write=True):
|
||||
global i
|
||||
message = f"{bcolors.OKCYAN}{message}{bcolors.ENDC}"
|
||||
if thread != "":
|
||||
|
29
test.py
29
test.py
@ -4,22 +4,21 @@ import os
|
||||
os.remove("logs/main.log")
|
||||
#Test 1
|
||||
print("Everything should look like how you want it to.\n")
|
||||
log("i", "Testing...")
|
||||
log("i", "I should have a thread listed.", "otherThread")
|
||||
log("w", "Warning...")
|
||||
log("w", "I should have a thread listed.", "otherThread")
|
||||
log("e", "Error!")
|
||||
log("e", "I should have a thread listed.", "otherThread")
|
||||
log("Testing...", "i")
|
||||
log("I should have a thread listed.", "i", "otherThread")
|
||||
log("Warning...", "w")
|
||||
log("I should have a thread listed.", "w", "otherThread")
|
||||
log("Error!", "e")
|
||||
log("I should have a thread listed.", "e", "otherThread")
|
||||
print("\nYou should stop seeing any details!\n")
|
||||
log("i", "Testing...", "", False)
|
||||
log("i", "I should have a thread listed.", "otherThread",False)
|
||||
log("w", "Warning...", "", False)
|
||||
log("w", "I should have a thread listed.", "otherThread", False)
|
||||
log("e", "Error!", "", False)
|
||||
log("e", "I should have a thread listed.", "otherThread", False)
|
||||
log("Testing...", "i", "", False)
|
||||
log("I should have a thread listed.", "i", "otherThread",False)
|
||||
log("Warning...", "w", "", False)
|
||||
log("I should have a thread listed.", "w", "otherThread", False)
|
||||
log("Error!", "e", "", False)
|
||||
log("I should have a thread listed.", "e", "otherThread", False)
|
||||
print("\nYou should not see the following in the log file!\n")
|
||||
log("i", "I should not appear in the log file!", "", False, False)
|
||||
log("i", "I should not appear in the log file!", "", True, False)
|
||||
log("I should not appear in the log file!", "i", "", False, False)
|
||||
log("I should not appear in the log file!", "i", "", True, False)
|
||||
|
||||
print("\nMake sure the log file doesn't have the above or any color codes!")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user