lib-not-dr/lib_not_dr/logger/__init__.py

34 lines
845 B
Python
Raw Normal View History

2023-10-23 23:40:36 +08:00
# -------------------------------
# Difficult Rocket
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
# All rights reserved
# -------------------------------
import sys
2023-11-06 00:19:39 +08:00
from lib_not_dr.types.options import Options
2023-10-23 23:40:36 +08:00
COLOR_SUPPORT = True
if sys.platform == "win32":
try:
# https://stackoverflow.com/questions/36760127/...
# how-to-use-the-new-support-for-ansi-escape-sequences-in-the-windows-10-console
from ctypes import windll
kernel32 = windll.kernel32
kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7)
except OSError: # pragma: no cover
COLOR_SUPPORT = False
2023-11-06 00:19:39 +08:00
class LogLevel(Options):
name = 'LogLevel'
notset: int = 0
trace: int = 5
fine: int = 7
debug: int = 10
info: int = 20
warn: int = 30
error: int = 40
fatal: int = 50