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

  1. Add to INSTALLED_APPS in your settings.py:

INSTALLED_APPS = [
    # ... your apps
    'logmancer',
]
  1. Add middleware (optional but recommended):

MIDDLEWARE = [
    # ... your middleware
    'logmancer.middleware.DBLoggingMiddleware',
]
  1. Configure Logmancer:

LOGMANCER = {
    'ENABLE_MIDDLEWARE': True,
    'AUTO_LOG_EXCEPTIONS': True,
    'CLEANUP_AFTER_DAYS': 30,
}
  1. 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

  1. Navigate to /admin/logmancer/logentry/

  2. View, filter, and search logs

  3. 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