Skip to content

Commit

Permalink
logging_revamp: add null handler in api endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
CalvoM committed Apr 20, 2023
1 parent da77e20 commit 2b7a8ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 4 additions & 0 deletions uaclient/api/api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
from importlib import import_module
from typing import Callable, List

Expand Down Expand Up @@ -35,6 +36,9 @@
def call_api(
endpoint_path: str, options: List[str], cfg: UAConfig
) -> APIResponse:
# setup null handler for all API endpoints
logging.getLogger("uaclient").addHandler(logging.NullHandler())

if endpoint_path not in VALID_ENDPOINTS:
return error_out(
APIError(
Expand Down
1 change: 0 additions & 1 deletion uaclient/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ def clear_handlers():
def logging_sandbox():
# Monkeypatch a replacement root logger, so that our changes to logging
# configuration don't persist outside of the test
# root_logger = logging.RootLogger(logging.WARNING)
root_logger = logging.getLogger("uaclient")
root_logger.setLevel(logging.WARNING)

Expand Down

0 comments on commit 2b7a8ef

Please sign in to comment.