Opt: typing for logger

This commit is contained in:
18870 2022-08-22 13:42:05 +08:00
parent 391ebf8b47
commit 929374104d
2 changed files with 57 additions and 0 deletions

View File

@ -348,6 +348,7 @@ logger.hr = hr
logger.attr = attr
logger.attr_align = attr_align
logger.set_file_logger = set_file_logger
logger.set_func_logger = set_func_logger
logger.rule = rule
logger.print = print
logger.log_file: str

56
module/logger.pyi Normal file
View File

@ -0,0 +1,56 @@
import logging
from typing import Any, Callable
from rich.highlighter import RegexHighlighter
from rich.console import Console, ConsoleRenderable
from rich.theme import Theme
class HTMLConsole(Console): ...
class Highlighter(RegexHighlighter): ...
WEB_THEME: Theme
logger_debug: bool
pyw_name: str
file_formatter: logging.Formatter
console_formatter: logging.Formatter
web_formatter: logging.Formatter
stdout_console: Console
class __logger(logging.Logger):
def rule(
title: str = "",
*,
characters: str = "-",
style: str = "rule.line",
end: str = "\n",
align: str = "center",
) -> None: ...
def hr(
title: str,
level: int = 3,
) -> None: ...
def attr(
name: str,
text: str,
) -> None: ...
def attr_align(
name: str,
text: str,
front: str = "",
align: int = 22,
) -> None: ...
def set_file_logger(
name: str = pyw_name,
) -> None: ...
def set_func_logger(
func: Callable[[Any], Any],
) -> None: ...
def print(
*objects: ConsoleRenderable,
**kwargs,
) -> None: ...
logger: __logger