Skip to main content

DetailLogger logo


🎨 DetailLogger V 0.2.0


Python License GitHub Stars GitHub Forks


✨ Overview

DetailLogger is a lightweight Python utility for enhanced logging and exception data tracing. It automatically captures contextual information—such as file name, function, and line number—whenever messages or exceptions are logged. The clear and complete exception information is very useful for debugging, monitoring, and building maintainable systems.


📦 Installation

pip install detaillogger


⚙️ Features

  • ✅ Logs messages with caller context
  • ✅ Captures exceptions with full traceback and information
  • ✅ Supports console and file-based logging
  • ✅ Built entirely on standard libraries

✍️ API Overview

  • DetailLogger(level, fmt, file_name): Create an instance with optional file output and log level
  • log(message: str): Logs message with caller metadata
  • log_exception(ex: BaseException, details: Optional[str]): Logs exception type, message, optional details, and source context

🧪 Usage

Run the built-in CLI demo for testing:

python core.py

Embedded Example

from detaillogger import log, log_exception

log("This is a message to log.")

try:
    x = 1 / 0
except Exception as e:
    log_exception(e, details="This is a message about the exception to log.")

Console Output:

2025-07-28 17:02:27,674 - DEBUG - Details:  This is a message to log.
2025-07-28 17:02:27,674 - DEBUG - From:     c:\Users\ryan\...detaillogger.py
2025-07-28 17:02:27,675 - DEBUG - Function: main()
2025-07-28 17:02:27,675 - DEBUG - Line:     3

2025-07-28 17:05:22,185 - DEBUG - Exception type:    ZeroDivisionError
2025-07-28 17:05:22,186 - DEBUG - Exception message: division by zero
2025-07-28 17:05:22,186 - DEBUG - Details:           This is a message about the exception to log.
2025-07-28 17:05:22,186 - DEBUG - File:              ...detaillogger.py
2025-07-28 17:05:22,186 - DEBUG - Function:          main()
2025-07-28 17:05:22,186 - DEBUG - Line:              6

Embedded Example

# To log to a file and console, instantiate DetailLogger class with filename.
from detaillogger import log, log_exception

logger = DetailLogger(file_name="detail.log")

log("This is a message to log to file.")

try:
    x = 1 / 0
except Exception as e:
    log_exception(e, details="This is a message about the exception to log to file.")

File Output:

detail.log

Also log to file? (y/n):y
Enter filname:detail.log

Options
1) Log details.
2) Log 'division by zero' exception.
3) Log custom exception.
q) Exit.
Enter an option:1

Enter message to log:This is a message.
2025-07-30 14:46:04,161 - DEBUG - Details:  This is a message.
2025-07-30 14:46:04,161 - DEBUG - From:     c:\Users\ryan\Visual Code Projects\git_repositories\detaillogger\detaillogger.py
2025-07-30 14:46:04,162 - DEBUG - Function: main()
2025-07-30 14:46:04,162 - DEBUG - Line:     179

Message logged.

🧱 File Structure

detaillogger/
├── detaillogger/
│   ├──core.py
│   ├──detaillogger.py         # Core logic
│   ├──__init__.py
├── assets/                 # Folder for images, badges, or other static assets
│   ├── detaillogger_logo_2.png     # Logo for documentation
│   └── image.png                   # File output 
├── README.md             # Documentation
├── pyproject.toml      
├── setup.cfg
└── setup.py

🤝 Contributing

Pull requests are welcome! For major changes, open an issue to discuss improvements first.


📄 License

This project is licensed under the MIT License.


👤 Author

Created by Ryan LaPine @rlapine — a technically skilled developer focused on clarity, maintainability, and audience-ready documentation. This class is part of a broader effort to build reusable, well-documented tools for data-driven projects.


📬 Contact

Feel free to reach out with questions or collaboration ideas:

📧 github.stunt845@passinbox.com
🔗 GitHub: @rlapine

Metadata

Release files for detaillogger 0.2.0

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

Source distribution (sdist)

Source distribution for detaillogger 0.2.0
File Size Uploaded
detaillogger-0.2.0.tar.gz 1.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for detaillogger 0.2.0
File Interpreter ABI Platform
detaillogger-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.6 MB

Release files / detaillogger-0.2.0.tar.gz

Download URL detaillogger-0.2.0.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
0303f87ad851bf5cee8bd63000715e84d4af51256c66af5c7c07de8e8ff42fcb
BLAKE2b-256 checksum
How to use checksums
1b30e8dfd6951b07a687b40c09674eeaebbc72d8cf9bf3e7eaa0fcfd6f2a9b1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.4

Release files / detaillogger-0.2.0-py3-none-any.whl

Download URL detaillogger-0.2.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2fe997537b0fb3a442f74496e6d4b88d33e2153f24f2892483036a8e8414b64e
BLAKE2b-256 checksum
How to use checksums
92993e2c989804e8cafbf1ef8cf6a8425c1ca22e3900526f25df8ff8bfc1cc91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.4

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.9

2 release files

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