mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-25 10:01:10 +00:00
37 lines
909 B
Python
37 lines
909 B
Python
import logging
|
|
import os
|
|
import sys
|
|
|
|
os.chdir(os.path.join(os.path.dirname(__file__), '../../'))
|
|
|
|
logger = logging.getLogger("deploy")
|
|
_logger = logger
|
|
|
|
formatter = logging.Formatter(fmt="%(message)s")
|
|
hdlr = logging.StreamHandler(stream=sys.stdout)
|
|
hdlr.setFormatter(formatter)
|
|
logger.addHandler(hdlr)
|
|
logger.setLevel(logging.INFO)
|
|
|
|
|
|
def hr(title, level=3):
|
|
if logger is not _logger:
|
|
return logger.hr(title, level)
|
|
|
|
title = str(title).upper()
|
|
if level == 0:
|
|
middle = "|" + " " * 20 + title + " " * 20 + "|"
|
|
border = "+" + "-" * (len(middle) - 2) + "+"
|
|
logger.info(border)
|
|
logger.info(middle)
|
|
logger.info(border)
|
|
if level == 1:
|
|
logger.info("=" * 20 + " " + title + " " + "=" * 20)
|
|
if level == 2:
|
|
logger.info("-" * 20 + " " + title + " " + "-" * 20)
|
|
if level == 3:
|
|
logger.info(f"<<< {title} >>>")
|
|
|
|
|
|
logger.hr = hr
|