-
-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(958) Add exception logging in debug mode (#976)
* feat: add console output for exceptions in debug mode * chore: middleware debug logging updates * feat: #958 testing passing * Update starlite/middleware/exceptions/middleware.py Co-authored-by: Na'aman Hirschfeld <nhirschfeld@gmail.com> * chore: fixed test for middleware debug logging (#958) * Update tests/middleware/test_exception_handler_middleware.py * chore: fixed test for middleware debug logging (#958) * Use `get_logger` fixture to test exception logged in debug. - moves get_logger fixture to conftest.py for middleware tests - patches app logger in tests with one that propagates so caplog works. * chore: Updated assertions (#958) * Update starlite/middleware/exceptions/middleware.py Co-authored-by: Na'aman Hirschfeld <nhirschfeld@gmail.com> * chore: update logger method --------- Co-authored-by: Jacob Coffee <jcoffee5@oreillyauto.com> Co-authored-by: Cody Fincher <204685+cofin@users.noreply.github.com> Co-authored-by: Na'aman Hirschfeld <nhirschfeld@gmail.com> Co-authored-by: provinzkraut <25355197+provinzkraut@users.noreply.github.com> Co-authored-by: Peter Schutt <peter@topsport.com.au> Co-authored-by: Peter Schutt <peter_schutt@bigpond.com> Co-authored-by: Peter Schutt <peter.github@proton.me>
- Loading branch information
1 parent
354942e
commit 21f4a2f
Showing
4 changed files
with
68 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from typing import TYPE_CHECKING | ||
|
||
import pytest | ||
|
||
from starlite.config.logging import LoggingConfig, default_handlers | ||
|
||
if TYPE_CHECKING: | ||
from starlite.types.callable_types import GetLogger | ||
|
||
|
||
@pytest.fixture | ||
def get_logger() -> "GetLogger": | ||
# due to the limitations of caplog we have to place this call here. | ||
# we also have to allow propagation. | ||
return LoggingConfig( | ||
handlers=default_handlers, | ||
loggers={ | ||
"starlite": {"level": "DEBUG", "handlers": ["queue_listener"], "propagate": True}, | ||
}, | ||
).configure() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters