master > master: code-py - tarjan + stacks + logging
This commit is contained in:
0
code/python/src/core/__init__.py
Normal file
0
code/python/src/core/__init__.py
Normal file
64
code/python/src/core/log.py
Normal file
64
code/python/src/core/log.py
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/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);
|
||||
Reference in New Issue
Block a user