Files
py-onebot/src/py_onebot/utils.py
2026-03-07 18:54:40 +00:00

25 lines
635 B
Python

from datetime import datetime
from sys import stdout, stderr
def log(s: str):
date = f"{datetime.today().year}-{datetime.today().month}-{datetime.today().day} {datetime.today().hour}:{datetime.today().minute}:{datetime.today().second}"
l = f"[{date}] <INFO>\t{s}\n\r"
stdout.write(l)
def elog(s: str):
date = f"{datetime.today().year}-{datetime.today().month}-{datetime.today().day} {datetime.today().hour}:{datetime.today().minute}:{datetime.today().second}"
l = f"\033[0;31m[{date}] ERROR:\t{s} \033[0m\n\r"
stderr.write(l)
def dbg(s):
l = f"\033[0;31m DEBUG:\t{str(s)} \033[0m\n"
print(l)