Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
AAriam committed Sep 11, 2024
1 parent 04ea154 commit 6bc888c
Show file tree
Hide file tree
Showing 6 changed files with 488 additions and 825 deletions.
15 changes: 3 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,12 @@ namespaces = true
# ----------------------------------------- Project Metadata -------------------------------------
#
[project]
version = "0.0.0.dev12"
version = "0.0.0.dev13"
name = "LoggerMan"
dependencies = [
"markitup",
"mdit",
"actionman",
"ansi-sgr",
"PyProtocol",
]
requires-python = ">=3.10"

#[project.scripts]
#am-print-h1 = "loggerman._cli:h1"
#am-print-h2 = "loggerman._cli:h2"
#am-print-h3 = "loggerman._cli:h3"
#am-print-h4 = "loggerman._cli:h4"
#am-print-h5 = "loggerman._cli:h5"
#am-print-h6 = "loggerman._cli:h6"
#am-print-file = "loggerman._cli:file"
#am-print-entry-gh = "loggerman._cli:entry_github"
72 changes: 27 additions & 45 deletions src/loggerman/__init__.py
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())
Loading

0 comments on commit 6bc888c

Please sign in to comment.