Summary
-
allows for the logging of the exception happening in the flask-graphql framework.
-
this hooks into the graphql error handler and logs the original error, along with its stacktrace
-
this allows one to see the data for an error like
{
"errors": [
{
"message": "sdsd",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"users"
]
}
],
"data": {
"users": null
}
}
as
2020-04-06 00:02:43,217 - LIA-logger:30 - ERROR - error in resolvers
Traceback (most recent call last):
File "/Users/brianrotich/.pyenv/versions/3.6.10/envs/test-app/lib/python3.6/site-packages/graphql/execution/executor.py", line 452, in resolve_or_error
return executor.execute(resolve_fn, source, info, **args)
File "/Users/brianrotich/.pyenv/versions/3.6.10/envs/test-app/lib/python3.6/site-packages/graphql/execution/executors/sync.py", line 16, in execute
return fn(*args, **kwargs)
File "/Users/brianrotich/.pyenv/versions/3.6.10/envs/test-app/lib/python3.6/site-packages/graphene/relay/connection.py", line 161, in connection_resolver
resolved = resolver(root, info, **args)
File "/Users/brianrotich/codes/app/test-app/__init__.py", line 187, in resolve_users
raise ValueError('sdsd')
ValueError: sdsd
Usage
a. using an existing logger in the app.py
import logging
import graphql_error_logger
def create_app():
# logger initialization and configuration
logger= logging.getLogger(__name__)
graphql_error_logger.init_logger(logger)
b. if no logger is provided, the library creates a logger called graphql-error-logger automatically
import graphql_error_logger
def create_app():
graphql_error_logger.init_logger()
- this logger is configured to use the
ERRORlog level to log the exception stacktrace
Release files for graphql-error-logger 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| graphql_error_logger-0.0.3.tar.gz | 2.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| graphql_error_logger-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.5 kB
Release files / graphql_error_logger-0.0.3.tar.gz
| Download URL | graphql_error_logger-0.0.3.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea21eb704800271ad800ff0b001f395b1e7b8897bf7119d07b889b0cfdf0dcd6
|
|
BLAKE2b-256 checksum How to use checksums |
f4f12a89a4d2f9b6319a5e1875bd92c776cd10f5992183a25fee62266ed7f9ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3
|
Release files / graphql_error_logger-0.0.3-py3-none-any.whl
| Download URL | graphql_error_logger-0.0.3-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
20b6d58c58add5703a20b45c90dd8e7b76f15d1354e36bae45058667c94bceae
|
|
BLAKE2b-256 checksum How to use checksums |
765fc8d6a9bf20701d8f86cc4622377cf64d3d1d8f961965a991d889730bcea3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3
|