Getting Started
Welcome to Logmancer! This guide will help you get started quickly.
Installation
Install using pip:
pip install django-logmancer
Or with uv:
uv add django-logmancer
Basic Setup
Add to
INSTALLED_APPSin yoursettings.py:
INSTALLED_APPS = [
# ... your apps
'logmancer',
]
Add middleware (optional but recommended):
MIDDLEWARE = [
# ... your middleware
'logmancer.middleware.DBLoggingMiddleware',
]
Configure Logmancer:
LOGMANCER = {
'ENABLE_MIDDLEWARE': True,
'AUTO_LOG_EXCEPTIONS': True,
'CLEANUP_AFTER_DAYS': 30,
}
Run migrations:
python manage.py migrate logmancer
First Steps
Manual Logging
from logmancer.utils import LogEvent
# Simple logging
LogEvent.info("Application started")
LogEvent.warning("Cache miss detected")
LogEvent.error("Database connection failed")
# With metadata
LogEvent.error("Payment failed", meta={
"user_id": 123,
"amount": 99.99,
"error_code": "CARD_DECLINED"
})
# With notifications
LogEvent.critical("System overload", notify=True)
View Logs in Admin
Navigate to
/admin/logmancer/logentry/View, filter, and search logs
Export logs as needed
Next Steps
Read the Configuration guide for all available options
Check the API Reference for detailed API documentation
See examples in the examples section