Open github-actions[bot] opened 4 months ago
https://github.com/Local-osu-Server/osu_client_server/blob/7bba76d62b6dcae54cd8bd1e474a9c8ffa653e9d/common/log.py#L28
import logging from colorama import Fore as Colors from colorama import Style from colorama import init as colorama_init colorama_init() logger: logging.Logger = None # type: ignore def setup_logging() -> logging.Logger: logging.basicConfig( filename="log.log", format="%(asctime)s %(message)s", filemode="w", ) logger = logging.getLogger() logger.setLevel(logging.DEBUG) logger.info("Logging setup") return logger # TODO: Probably have an enum of "log levels" and use that instead of the color parameter def log(message: str, color: str | None = None) -> None: if color == Colors.RED: print(Colors.RED + "ERROR: " + message + Style.RESET_ALL) elif color == Colors.YELLOW: print(Colors.YELLOW + "WARNING: " + message + Style.RESET_ALL) elif color == Colors.GREEN: print(Colors.GREEN + "SUCCESS: " + message + Style.RESET_ALL) else: print("INFO: " + message)
https://github.com/Local-osu-Server/osu_client_server/blob/7bba76d62b6dcae54cd8bd1e474a9c8ffa653e9d/common/log.py#L28