Skip to content

Commit

Permalink
refactor: make logging level configurable
Browse files Browse the repository at this point in the history
Signed-off-by: bossenti <[email protected]>
  • Loading branch information
bossenti committed Oct 19, 2023
1 parent 8c14442 commit 043e43a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions vistafetch/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class VistaFetchClient:
client_headers: additional headers to be sent with every request, optional
"""

def __init__(self, client_headers: Optional[Dict[str, str]] = None):
set_up_logging()
def __init__(self, client_headers: Optional[Dict[str, str]] = None, logging_level: Optional[int] = None):
set_up_logging(logging_level=logging_level)

http_headers = {"Application": "application/json; charset=utf-8"}

Expand Down
4 changes: 2 additions & 2 deletions vistafetch/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
]


def set_up_logging() -> None:
def set_up_logging(logging_level: int = logging.INFO) -> None:
"""Configure logging."""
log_format = "%(message)s"
logging.basicConfig(
level="NOTSET", format=log_format, datefmt="[%X]", handlers=[RichHandler()]
level=logging_level, format=log_format, datefmt="[%X]", handlers=[RichHandler()]
)

logging.debug("Logging set up successfully.")

0 comments on commit 043e43a

Please sign in to comment.