Make print_log() at least 5% less shit
This commit is contained in:
parent
e798886b7d
commit
e1c91a44ab
|
@ -9,16 +9,22 @@ def print_log(source, message, should_print=True):
|
||||||
if should_print == False:
|
if should_print == False:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
message_meta = build_message_meta(source)
|
||||||
|
|
||||||
if source == "Main":
|
if source == "Main":
|
||||||
print('\033[92m', current_time(), source.center(8, '-'), ': \033[0m', message)
|
print('\033[92m', message_meta, '\033[0m', message)
|
||||||
elif source == "Notice":
|
elif source == "Notice":
|
||||||
print('\033[93m', current_time(), source.center(8, '-'), ': \033[0m', message)
|
print('\033[93m', message_meta, '\033[0m', message)
|
||||||
elif source == "Warning":
|
elif source == "Warning":
|
||||||
print('\033[91m', current_time(), source.center(8, '-'), ': \033[0m', message)
|
print('\033[91m', message_meta, '\033[0m', message)
|
||||||
elif source == "Web":
|
elif source == "Web":
|
||||||
print('\033[95m', current_time(), source.center(8, '-'), ': \033[0m', message)
|
print('\033[95m', message_meta, '\033[0m', message)
|
||||||
else:
|
else:
|
||||||
print('\033[94m', current_time(), source.center(8, '-'), ': \033[0m', message)
|
print('\033[94m', message_meta, '\033[0m', message)
|
||||||
|
|
||||||
|
# Builds the metadata part for the messages above
|
||||||
|
def build_message_meta(source):
|
||||||
|
return current_time() + ' ' + source.center(8, '-') + ' :'
|
||||||
|
|
||||||
def current_time():
|
def current_time():
|
||||||
return time_to_string(time.time(), True)
|
return time_to_string(time.time(), True)
|
||||||
|
|
Loading…
Reference in New Issue