Skip to main content

DetailLogger is a lightweight Python utility for enhanced logging and exception data tracing.

Project description

DetailLogger logo


🎨 DetailLogger V 0.1.9


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
├── detaillogger.log      # Optional output log file

🤝 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

detaillogger-0.1.9.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

detaillogger-0.1.9-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file detaillogger-0.1.9.tar.gz.

File metadata

  • Download URL: detaillogger-0.1.9.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for detaillogger-0.1.9.tar.gz
Algorithm Hash digest
SHA256 9ad4d990694bf6943f8223e1f85b0fdf84acaf934d56ce74965dbb1e5e1cb2a3
MD5 a006458369dc1cc231e2314c589a86ea
BLAKE2b-256 f94d6a4dc018cc3851ad67c68b04f4daa5e0591540a452d3d39d729521d86880

See more details on using hashes here.

File details

Details for the file detaillogger-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: detaillogger-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for detaillogger-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 ec588c10c7c56309590a38273bd018c052b694d3d6c51ff9f8556c4ccf79e1f8
MD5 f0672745adeb35e941b6758e561a3aac
BLAKE2b-256 a4c24f7832c7609a0b3131b7973b86ba51b51776988e7ff50c9ef54e29c5fd3a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page