Django Javascript Logger
This is a very simple Django app for forwarding console logs and console errors to dedicated Django loggers.
Useful for catching Javascript errors that are not logged by Django natively and would otherwise only be logged to the client’s console. Can be particularly useful if you have JavaScript running on top of our server-side rendered views.
The app works by posting all relevant events to an internal Django API, which logs them to one of two loggers. Not sure what impact this has on an apps performance, but it likely should not run anywhere near performance-sensitive production environments. Primarily this is intended to be a debugging aid.
A flowchart of the app’s structure looks something like this:
The package is open to contributions.
Installation
Installing with pip:
pip install django-js-logger
Installing with poetry:
poetry add django-js-logger
Quick start
Add django_js_logger to your INSTALLED_APPS settings:
INSTALLED_APPS = [ ... 'django_js_logger', ]Include the packages URLconf in your project urls.py like this:
path('js-logs/', include('django_js_logger.urls')),Optionally, specify your logging preferences by adding JS_LOGGER to your settings:
JS_LOGGER = { 'CONSOLE_LOG_LEVEL': 'INFO', 'CONSOLE_ERROR_LEVEL': 'WARNING' }Add the required static file to your project by running manage.py collectstatic. This should add a folder, django_js_logger with the file logger.js. If this is not the case, you can copy the file manually from the demo project above.
Import logger.js in the views you wish to log from by adding a JS import to your templates:
<script src="static/django_js_logger/logger.js"></script>
Metadata
Release files for django-js-logger 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-js-logger-1.0.0.tar.gz | 5.3 kB | Without provenance | Details for django-js-logger-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_js_logger-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for django_js_logger-1.0.0-py3-none-any.whl |
Total release size: 11.4 kB
Release files / django-js-logger-1.0.0.tar.gz
| Download URL | django-js-logger-1.0.0.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e94079b58fa677d0d6c53f5ef49b829515e66bb2100fa1026bc033b25f0a74b3
|
|
BLAKE2b-256 checksum How to use checksums |
d00cadd0d5abfd0a6ff6b31535cbac580c5bbd6f514511e7dc12eabf16d40b98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.9 CPython/3.8.3 Linux/5.3.0-1031-azure
|
Release files / django_js_logger-1.0.0-py3-none-any.whl
| Download URL | django_js_logger-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
084cf1cb13055eedbe4b787bddfed0976f580a341c25ac805b761df8fbdb89f7
|
|
BLAKE2b-256 checksum How to use checksums |
92dbf7307f6ddd675ced920c2de0617906eb1af6d49d0a0cc9b3165492d95297
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.9 CPython/3.8.3 Linux/5.3.0-1031-azure
|
Security for django-js-logger 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.