init.
This commit is contained in:
24
src/py_onebot/utils.py
Normal file
24
src/py_onebot/utils.py
Normal file
@@ -0,0 +1,24 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user