ScrapMods/Logger
2023-02-07 19:38:24 +11:00
..
scripts/custom Fixed crashes 2023-02-07 19:38:24 +11:00
README.md Fixed crashes 2023-02-07 19:38:24 +11:00

Logger

Logger for logging stuff. Thanks to @earthnuker.

Quick snippet for initialisation in your .py file

logger = None

try:
    logger = __import__("Logger").Logger("Police")
except Exception:
    pass


def log(msg):
    if logger is not None:
        logger.info(msg)
    else:
        Scrap.Print("[Logger][File] " + str(msg) + "\n")


log("Starting module")

logger.info("A")
logger.error("OH NO!")

NOTE: Never do something like:

if logger:
    this
else:
    that

It will crahs.

TODO: come up with better system