65 lines
1.6 KiB
Python
65 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
# IMPORTS
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
#
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
# EXPORTS
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
__all__ = [
|
|
'log_info',
|
|
'log_debug',
|
|
'log_warn',
|
|
'log_error',
|
|
'log_fatal',
|
|
];
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
# METHODS logging
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
def log_info(*text: str):
|
|
'''
|
|
Prints an info message
|
|
'''
|
|
for line in text:
|
|
print("[\x1b[94;1mINFO\x1b[0m] {}".format(line));
|
|
return;
|
|
|
|
def log_debug(*text: str):
|
|
'''
|
|
Prints a debug message
|
|
'''
|
|
for line in text:
|
|
print("[\x1b[96;1mDEBUG\x1b[95;0m] {}".format(line));
|
|
return;
|
|
|
|
def log_warn(*text: str):
|
|
'''
|
|
Prints a warning message
|
|
'''
|
|
for line in text:
|
|
print("[\x1b[93;1mWARNING\x1b[0m] {}".format(line));
|
|
return;
|
|
|
|
def log_error(*text: str):
|
|
'''
|
|
Prints an error message
|
|
'''
|
|
for line in text:
|
|
print("[\x1b[91;1mERROR\x1b[0m] {}".format(line));
|
|
return;
|
|
|
|
def log_fatal(*text: str):
|
|
'''
|
|
Prints a fatal error message + crashes
|
|
'''
|
|
for line in text:
|
|
print("[\x1b[91;1mFATAL\x1b[0m] {}".format(line));
|
|
exit(1);
|