Skip to main content

Improved logging wrapper with colored output and timestamps.

Project description

🪶 logbetter

logbetter is a lightweight Python logging utility that enhances console logging with clean, colored, and readable output.
It extends Python's built-in logging module with:

  • ✨ Colored console output
  • 🕒 Automatic timestamps
  • ✅ Success log level
  • 📁 Optional file logging
  • 🚀 Developer-friendly API

Ideal for CLI tools, scripts, automation, and backend services.


🔧 Installation

Install via PyPI:

pip install logbetter

Or install directly from GitHub:

pip install git+https://github.com/pp5253397/logbetter.git

🧩 Quick Start

from logbetter import log

log.info("Application started")
log.success("Data processed successfully")
log.warning("Low disk space")
log.error("Connection failed")
log.debug("Debug details here")

Example Output:

[2025-10-25 20:42:10] [ℹ️ INFO] Application started
[2025-10-25 20:42:10] [✅ SUCCESS] Data processed successfully
[2025-10-25 20:42:10] [⚠️ WARNING] Low disk space
[2025-10-25 20:42:10] [❌ ERROR] Connection failed
[2025-10-25 20:42:10] [🐞 DEBUG] Debug details here

🆕 Version History / Changelog

v0.0.3

  • ✅ Added success() log level
  • ✅ Optional file logging (log_to_file=True)
  • ✅ Improved timestamp formatting
  • ✅ Enhanced colored output
  • ✅ Customizable log format and timestamp

v0.0.2

  • Initial release
  • Basic colored log levels: DEBUG, INFO, WARNING, ERROR, CRITICAL
  • Timestamps with default format
  • Global log object for simple usage

⚙️ Logging Levels

Level Emoji Description
DEBUG 🐞 Debugging messages
INFO ℹ️ General informational messages
SUCCESS Successful operations
WARNING ⚠️ Warning messages
ERROR Errors
CRITICAL 🚨 Critical failures

⚙️ Configuration Options

from logbetter import LogBetter

custom_log = LogBetter()
custom_log.set_format("{time} | {level} | {message}")  # Custom log format
custom_log.set_time_format("%H:%M:%S")                  # Custom timestamp format
custom_log.disable_time()                               # Hide timestamps if desired
Parameter Type Default Description
name str "logbetter" Logger name
level str "INFO" Logging level (DEBUG, INFO, SUCCESS, WARNING, ERROR, CRITICAL)
log_to_file bool False Save logs to a file
filename str "logbetter.log" Log file name

🧩 File Logging

Enable file logging:

log = LogBetter(log_to_file=True, filename="app.log")
log.info("This message is printed and saved to app.log")

All messages are automatically written to the file alongside console output.


🛠️ Customization

Custom Log Format

log.set_format("{time} - {level} >>> {message}")

Custom Timestamp Format

log.set_time_format("%Y-%m-%d %H:%M:%S")

Disable Timestamps

log.disable_time()

📦 Project Info

Field Details
Author Parth Patel
Email pp5253397@gmail.com
License MIT
Repository GitHub
PyPI PyPI

💡 Contributing

We welcome contributions!

  1. Fork the repository
  2. Create a new branch (feature/my-feature)
  3. Commit your changes (git commit -m "Add feature")
  4. Push your branch (git push origin feature/my-feature)
  5. Open a Pull Request

Please follow PEP8 style and include tests for new features.


🪶 License

This project is licensed under the MIT License — see the LICENSE file for details.

Made with ❤️ by Parth Patel
Clean, colorful, and better logs — because your console deserves style.

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

logbetter-0.0.3.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

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

logbetter-0.0.3-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file logbetter-0.0.3.tar.gz.

File metadata

  • Download URL: logbetter-0.0.3.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for logbetter-0.0.3.tar.gz
Algorithm Hash digest
SHA256 5b6cc1c1600916779f4c72decc6ec94fff75fdbf535126b409849c24b375e6e6
MD5 de6b20d6c4568c6361941a1e85dc8f84
BLAKE2b-256 fda1bb7399cc6f074c2032c34eda946c01dff59d47cd49204f036a73e3544315

See more details on using hashes here.

File details

Details for the file logbetter-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: logbetter-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for logbetter-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cc5d44dbe39f24ce566f71b7b3309ba7dab8f7eb0e652b41df080d391547fdc6
MD5 29bfee0d858d5c7f523ab60519241dd7
BLAKE2b-256 89e4bdd5bfb4260ca029d579e69f6b971cd7f9c05ba93f986be2283b6490cf88

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