Skip to main content

Smart Logger

Smart Logger is a Python logging library with FastAPI, Flask, and Django support. It provides UUID-based logs, date/parent_folder structured logs, database metadata storage, and a FastAPI dashboard with filters, real-time monitoring, charts.


Features

  • Multi-framework support: FastAPI, Flask, Django

  • Structured logging: UUID for each log entry

  • Dynamic folder structure: date/parent_folder/filename.log

  • Database metadata storage (default SQLite)

  • SmartLogger class with logging levels:

    • logger.info()
    • logger.error()
    • logger.warning()
    • logger.critical()
    • logger.debug()
  • FastAPI Dashboard UI:

    • Real-time logs
    • Filter logs by date, time, UUID, log type
    • Bar charts for daily, monthly, yearly log insights
    • System info cards and statistics
    • Interactive UI with logout functionality
  • Secure: input sanitization, token-based authentication, blacklist token support

  • CLI commands for user management, configuration, and server launch


Installation

pip install az-smart-logger

Quick Setup (Step by Step)

  1. Generate default config file

    smart-logger make-smart-logger-default-conf
    

    → This creates a config file in your project folder.

  2. Update config file

    • Add your database credentials, log paths, and other settings.
  3. Set the configuration

    smart-logger set_config
    
  4. Verify active configuration

    smart-logger show_config
    

    → Ensures everything is correctly set.

  5. Initialize database tables

    smart-logger init-db
    
  6. Create an admin user

    smart-logger create-admin-user
    
  7. Run the Smart Logger Dashboard UI

    smart-logger ui --host 127.0.0.1 --port 8000
    

✅ Now your logging system with UI is ready!


Usage

1. FastAPI Example

from fastapi import FastAPI
from smart_logger import SmartLogger

app = FastAPI()
logger = SmartLogger()

@app.get("/")
def home():
    logger.info("Home accessed")  # UUID, folder, filename auto-detected
    return {"message": "Hello FastAPI"}

2. Flask Example

from flask import Flask
from smart_logger import SmartLogger

app = Flask(__name__)
logger = SmartLogger()

@app.route("/")
def home():
    logger.info("Home accessed")
    return "Hello Flask"

3. Django Example

from smart_logger import SmartLogger

logger = SmartLogger()

def example_view(request):
    logger.info("Django view accessed")
    from django.http import HttpResponse
    return HttpResponse("Hello Django")

CLI Commands

Launch Dashboard UI

smart-logger ui --host 127.0.0.1 --port 8000 --workers 1 --reload False
  • --reload optional (default False)
  • Runs isolated FastAPI server independent of main project

Initialize Database Tables

smart-logger init-db

Admin User Management

  • Create admin user:
smart-logger create-admin-user
  • Change password:
smart-logger change-password <email>
  • Forgot password (reset without old password):
smart-logger forgot-password <email>
  • List users:
smart-logger list-users
  • Delete user:
smart-logger delete-user <email>

Configuration Management

  • Set global config:
smart-logger set_config
  • Show active config:
smart-logger show_config
  • Create default config:
smart-logger make-smart-logger-default-conf

Folder Structure

smart_logger/
├── cli/
├── config/
├── core/
├── exceptions/
├── models/
├── security/
├── ui/
├── tests/
├── examples/
├── setup.py
├── pyproject.toml
├── setup.cfg
├── LICENSE
└── README.md
  • core/ → Logger class, DB handlers
  • ui/ → Dashboard server, templates, static files
  • cli/ → Commands for server launch, user management
  • models/ → SQLAlchemy models
  • security/ → Auth, middleware, blacklist token
  • config/ → Default and global configuration
  • tests/ → Unit and integration tests
  • examples/ → Usage examples

Logging API

from smart_logger import SmartLogger

logger = SmartLogger()

logger.info("Informational message")
logger.warning("Warning message")
logger.error("Error message")
logger.critical("Critical message")
logger.debug("Debugging message")
  • Folder and file auto-detection: module name used if not provided
  • UUID generated for every log entry
  • Database metadata stored automatically

Dashboard Features

  • Real-time log view

  • Filter by: date, time, UUID, log type

  • Charts:

    • Daily/Monthly/Yearly error insights
    • Bar charts by log type
  • System info: CPU, memory, uptime

  • Cards & Stats for quick overview

  • Logout button for secure access


License

MIT License. See LICENSE file for details.


✅ Key Points:

  1. Step-by-step setup guide added.
  2. Clear instructions for installation and usage.
  3. Examples for FastAPI, Flask, Django included.
  4. CLI instructions for UI and DB initialization.
  5. Folder structure overview for developers.
  6. Ready for PyPI and GitHub documentation.

Metadata

Release files for az-smart-logger 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for az-smart-logger 1.0.5
File Size Uploaded Provenance
az_smart_logger-1.0.5.tar.gz 33.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for az-smart-logger 1.0.5
File Interpreter ABI Platform
az_smart_logger-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 81.6 kB

Release files / az_smart_logger-1.0.5.tar.gz

Download URL az_smart_logger-1.0.5.tar.gz
Size 33.4 kB
Tags Source
SHA-256 checksum
How to use checksums
da376ca3471a5c6dffd511c8fad2a8af02221269eae5ab2821d037c71aa8dc55
BLAKE2b-256 checksum
How to use checksums
7be4732d25b76e31b89ce136a1e184d6417c7c68c7a7bbc1a5775922f3033e88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / az_smart_logger-1.0.5-py3-none-any.whl

Download URL az_smart_logger-1.0.5-py3-none-any.whl
Size 48.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9104cdcb33ac0b26a21f8a991a6db3488a20578d41c3bc335e0aebeb6e1d1cee
BLAKE2b-256 checksum
How to use checksums
61c52497c820416393a0bc64509b7c3dc3cc86cf8d7bff02570cb6df336411b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for az-smart-logger 1.0.5

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page