-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
488 additions
and
825 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,40 @@ | ||
"""LoggerMan""" | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING as _TYPE_CHECKING | ||
|
||
from typing import Literal as _Literal, Type as _Type, Sequence as _Sequence, Any as _Any | ||
from pathlib import Path as _Path | ||
from loggerman import style | ||
from loggerman.logger import Logger, LogLevel | ||
|
||
import ansi_sgr as sgr | ||
|
||
from loggerman.logger import Logger, LogLevel | ||
from loggerman.style import ConsoleHeadingStyle, LogStyle | ||
if _TYPE_CHECKING: | ||
from typing import Type, Sequence, Callable | ||
from mdit.protocol import TargetConfig, ANSITargetConfig | ||
from loggerman.style import LogLevelStyle | ||
|
||
|
||
logger = Logger() | ||
|
||
|
||
def create( | ||
realtime: bool = True, | ||
realtime_levels: Sequence[str | int | LogLevel] | None = tuple(range(1, 7)), | ||
github: bool = False, | ||
min_console_log_level: LogLevel | None = LogLevel.DEBUG, | ||
init_section_number: int = 1, | ||
exit_code_critical: int | None = 1, | ||
sectioner_exception_catch: _Type[Exception] | _Sequence[_Type[Exception]] | None = None, | ||
sectioner_exception_log_level: LogLevel | _Literal[ | ||
"debug", "info", "notice", "warning", "error", "critical" | ||
] = LogLevel.CRITICAL, | ||
sectioner_exception_return_value: _Any = None, | ||
output_html_filepath: str | _Path | None = "log.html", | ||
root_heading: str = "Log", | ||
html_title: str = "Log", | ||
html_style: str = "", | ||
h1_style: ConsoleHeadingStyle = ConsoleHeadingStyle( | ||
sgr_sequence=sgr.style(text_styles="bold", text_color=(150, 0, 170)) | ||
), | ||
h2_style: ConsoleHeadingStyle = ConsoleHeadingStyle( | ||
sgr_sequence=sgr.style(text_styles="bold", text_color=(25, 100, 175)) | ||
), | ||
h3_style: ConsoleHeadingStyle = ConsoleHeadingStyle( | ||
sgr_sequence=sgr.style(text_styles="bold", text_color=(100, 160, 0)) | ||
), | ||
h4_style: ConsoleHeadingStyle = ConsoleHeadingStyle( | ||
sgr_sequence=sgr.style(text_styles="bold", text_color=(200, 150, 0)) | ||
), | ||
h5_style: ConsoleHeadingStyle = ConsoleHeadingStyle( | ||
sgr_sequence=sgr.style(text_styles="bold", text_color=(240, 100, 0)) | ||
), | ||
h6_style: ConsoleHeadingStyle = ConsoleHeadingStyle( | ||
sgr_sequence=sgr.style(text_styles="bold", text_color=(220, 0, 35)) | ||
), | ||
debug_style: LogStyle = LogStyle(symbol="π"), | ||
info_style: LogStyle = LogStyle(symbol="βΉοΈ"), | ||
notice_style: LogStyle = LogStyle(symbol="β"), | ||
warning_style: LogStyle = LogStyle(symbol="π¨"), | ||
error_style: LogStyle = LogStyle(symbol="π«"), | ||
critical_style: LogStyle = LogStyle(symbol="β"), | ||
caller_symbol: str = "π", | ||
github_debug: bool = True, | ||
title_number: int | Sequence[int] = 1, | ||
exception_handler: dict[Type[Exception], Callable] | None = None, | ||
exit_code_critical: int | None = None, | ||
target_config_md: dict[str, TargetConfig | dict] | None = None, | ||
target_config_ansi: ANSITargetConfig | dict | None = None, | ||
level_style_debug: LogLevelStyle = style.log_level(admo_class="hint", gh_title_prefix="π"), | ||
level_style_success: LogLevelStyle = style.log_level(admo_class="seealso", gh_title_prefix="β "), | ||
level_style_info: LogLevelStyle = style.log_level(admo_class="note", gh_title_prefix="βΉοΈ"), | ||
level_style_notice: LogLevelStyle = style.log_level(admo_class="attention", gh_title_prefix="β"), | ||
level_style_warning: LogLevelStyle = style.log_level(admo_class="warning", gh_title_prefix="π¨"), | ||
level_style_error: LogLevelStyle = style.log_level(admo_class="danger", dropdown=False, | ||
gh_title_prefix="π«"), | ||
level_style_critical: LogLevelStyle = style.log_level(admo_class="error", dropdown=False, | ||
gh_title_prefix="β"), | ||
prefix_caller: str = "π", | ||
prefix_time: str = "β°", | ||
) -> Logger: | ||
kwargs = locals() | ||
return Logger().initialize(**kwargs) | ||
return Logger().initialize(**locals()) |
Oops, something went wrong.