Skip to content

Commit

Permalink
✨ Add cliconfig own logger
Browse files Browse the repository at this point in the history
  • Loading branch information
valentingol committed Jan 12, 2024
1 parent c8baa28 commit 4e04f0f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cliconfig/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
.. include:: ../DOCUMENTATION.md
"""

from cliconfig import (
_logger,
base,
cli_parser,
config_routines,
Expand All @@ -22,6 +22,7 @@
processing,
tag_routines,
)
from cliconfig._logger import create_logger
from cliconfig._version import __version__, __version_tuple__
from cliconfig.base import Config
from cliconfig.config_routines import (
Expand All @@ -46,9 +47,13 @@
create_processing_value,
)

_CLICONFIG_LOGGER = create_logger()

__all__ = [
"__version__",
"__version_tuple__",
"_CLICONFIG_LOGGER",
"_logger",
"Config",
"DefaultProcessings",
"Processing",
Expand Down
16 changes: 16 additions & 0 deletions cliconfig/_logger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2023 Valentin Goldite. All Rights Reserved.
"""Logging functions for cliconfig."""
import logging
import sys
from logging import Logger


def create_logger() -> Logger:
"""Create cliconfig logger."""
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
handler = logging.StreamHandler(sys.stdout)
formatter = logging.Formatter("%(levelname)s - %(message)s")
handler.setFormatter(formatter)
logger.addHandler(handler)
return logger

0 comments on commit 4e04f0f

Please sign in to comment.