A minimal logging utility
Firstly install it (package is temporarly not avaiable on PyPI!)
python -m pip install riccyLogs --break-system-packages
Then use it!
from riccyLogs import RiccyLogs
# initialize it
logging = RiccyLogs()
# configure it
logging.short_name_global = False # prints say WARN instead of WARNING
logging.enable_colors = True
# add your own!
logging.add_log_type("DEBUG", "DBG")
# supports ANSI colouring AND function callbacks!
# remember: coloring gets reset automatically AND function callback happens AFTER printing!
def test():
print("hi hello hiii!!")
logging.add_log_type("TESTING", "TEST", "\x1b[1;31m", test)
# and then use them!
logging.log("TESTING", "beep boop")
# force the short flag if you want to
logging.log("TESTING", "beep boop", True) # instead of [TESTING] beep boop it appears as [TEST] beep boop even though global flag is disabled!
# there are built in ones too!
logging.log("WARNING", "something")
# and if you don't need anymore.. just remove them!
logging.remove_log_type("DEBUG")
logging.remove_log_type("TESTING")Run this command to install the testing suite:
pip install pytest
Then simply run in the root directory:
python -m pytest