Quick Start
Getting Started with django_logging is simple. Follow these steps to get up and running quickly:
Install the Package
first, Install django_logging via pip:
$ pip install dj-logging
Add to Installed Apps
Add django_logging to your
INSTALLED_APPSin your Django settings file:
INSTALLED_APPS = [
# ...
"django_logging",
# ...
]
Run Your Server
Start your Django Development server to verify the installation:
python manage.py runserver
when the server starts, you’ll see an initialization message like this in your console:
INFO | django_logging | Logging initialized with the following configurations:
Log File levels: ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'].
Log files are being written to: logs.
Console output level: DEBUG.
Colorize console: True.
Log date format: %Y-%m-%d %H:%M:%S.
Email notifier enabled: False.
By default, django_logging will log each level to its own file:
DEBUG :
logs/debug.logINFO :
logs/info.logWARNING :
logs/warning.logERROR :
logs/error.logCRITICAL :
logs/critical.log
In addition, logs will be displayed in colorized mode in the console, making it easier to distinguish between different log levels.
That’s it! django_logging is ready to use. For further customization, refer to the Settings.