Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
AAriam committed Sep 17, 2024
1 parent 6bc888c commit 4ddb9f8
Show file tree
Hide file tree
Showing 4 changed files with 428 additions and 238 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespaces = true
# ----------------------------------------- Project Metadata -------------------------------------
#
[project]
version = "0.0.0.dev13"
version = "0.0.0.dev14"
name = "LoggerMan"
dependencies = [
"mdit",
Expand Down
79 changes: 64 additions & 15 deletions src/loggerman/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

from typing import TYPE_CHECKING as _TYPE_CHECKING

import mdit as _mdit

from loggerman import style
from loggerman.logger import Logger, LogLevel

Expand All @@ -17,24 +19,71 @@


def create(
realtime_levels: Sequence[str | int | LogLevel] | None = tuple(range(1, 7)),
github: bool = False,
realtime_levels: Sequence[str | int | LogLevel] | None = None,
console_config: _mdit.target.rich.ConsoleConfig | dict = _mdit.target.rich.ConsoleConfig(),
github: bool | None = None,
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 = "⏰",
target_configs_md: dict[str, _mdit.MDTargetConfig | dict] | None = None,
target_configs_rich: dict[str, _mdit.RichTargetConfig | dict] | None = None,
target_default_md: str = "sphinx",
target_default_rich: str = "console",
list_entries: bool = True,
current_list_key: str = "",
level_style_debug: LogLevelStyle = style.log_level(
color="muted",
icon="🔘",
rich_config=_mdit.target.rich.PanelConfig(
title_style=_mdit.target.rich.StyleConfig(color="#fff", bgcolor="#6c757d", bold=True),
),

),
level_style_success: LogLevelStyle = style.log_level(
color="success",
icon="✅",
rich_config=_mdit.target.rich.PanelConfig(
title_style=_mdit.target.rich.StyleConfig(color="#fff", bgcolor="#28a745", bold=True),
),
),
level_style_info: LogLevelStyle = style.log_level(
color="info",
icon="ℹ️",
rich_config=_mdit.target.rich.PanelConfig(
title_style=_mdit.target.rich.StyleConfig(color="#fff", bgcolor="#17a2b8", bold=True),
),
),
level_style_notice: LogLevelStyle = style.log_level(
color="warning",
icon="❗",
rich_config=_mdit.target.rich.PanelConfig(
title_style=_mdit.target.rich.StyleConfig(color="#fff", bgcolor="#f0b37e", bold=True),
),
),
level_style_warning: LogLevelStyle = style.log_level(
color="warning",
icon="🚨",
rich_config=_mdit.target.rich.PanelConfig(
title_style=_mdit.target.rich.StyleConfig(color="#fff", bgcolor="#f0b37e", bold=True),
),
),
level_style_error: LogLevelStyle = style.log_level(
color="danger",
icon="🚫",
rich_config=_mdit.target.rich.PanelConfig(
title_style=_mdit.target.rich.StyleConfig(color="#fff", bgcolor="#dc3545", bold=True),
),
),
level_style_critical: LogLevelStyle = style.log_level(
color="danger",
opened=True,
icon="⛔",
rich_config=_mdit.target.rich.PanelConfig(
title_style=_mdit.target.rich.StyleConfig(color="#fff", bgcolor="#dc3545", bold=True),
),
),
prefix_caller_name: str = "🔔 ",
prefix_time: str = "⏰ ",
) -> Logger:
return Logger().initialize(**locals())
Loading

0 comments on commit 4ddb9f8

Please sign in to comment.