A custom logger package
Project description
LogMagix
LogMagix is a custom Python logging package that provides colorful and styled log messages for success, warnings, failures, and more. It also includes a loader class for displaying animated loading sequences in the terminal.
🔥 Features
- Log messages with success, warning, failure, and informational levels.
- Customize log message colors using ANSI color codes.
- Time-stamped log messages for tracking events.
- Animated loading spinner for long-running operations.
- Flexible message format and easy-to-use API.
⚙️ Installation
To install the package locally, clone the repository and run:
pip install .
Alternatively, once published, you can install it via pip from PyPI:
pip install logmagix
🔧 Usage
Import the Package
from logmagix import Logger, Loader
Basic Logging
Create an instance of the Logger class and log messages with different levels:
log = Logger()
# Success message
log.success("Operation completed successfully!")
# Failure message
log.failure("Something went wrong!")
# Warning message
log.warning("This is a warning!")
# Information message
log.info("Informational log message")
# Debug message
log.debug("Debugging log message")
Loading Animation
Use the Loader class to display an animated loading spinner during long-running operations:
from logmagix import Loader
import time
loader = Loader(desc="Connecting to server...")
with loader:
time.sleep(5) # Simulate a task that takes 5 seconds
Customizing Log Prefix
You can customize the prefix used in log messages by passing it as a parameter to the Logger:
log = Logger(prefix=".myapp/logs")
log.success("Custom prefix message")
🔎 Example
Here’s a full example demonstrating both logging and loader:
from logmagix import Logger, Loader
import time
# Initialize the logger
log = Logger()
# Log different types of messages
log.success("Everything is running smoothly!")
log.warning("This is a warning message.")
log.failure("Critical failure detected!")
# Use a loader for a long-running task
loader = Loader(desc="Processing data...")
with loader:
time.sleep(5) # Simulate a task that takes 5 seconds
log.success("Task completed!")
❗ Requirements
LogMagix requires the following Python package:
coloramafor cross-platform color support in the terminal.
Install colorama if it’s not already installed:
pip install colorama
©️ License
LogMagix is licensed under the MIT License. See the LICENSE file for more details.
🖥️ Contributing
Contributions are welcome! If you would like to contribute to the project, feel free to fork the repository and submit a pull request.
👤 Author
LogMagix is developed and maintained by sexfrance.
Enjoy using LogMagix to bring color and style to your Python logging!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logmagix-0.1.2.tar.gz.
File metadata
- Download URL: logmagix-0.1.2.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce76f9db09668052d41c8686d2f96b617658ddc62881b0702f939142ef1fa602
|
|
| MD5 |
b3fb226b347c666e9b0fd229d56dee28
|
|
| BLAKE2b-256 |
61ba8435524700f0090f26041bfc8f9f595f2bdb6ac9f5cf9b8109ffbd15c2c0
|
File details
Details for the file logmagix-0.1.2-py3-none-any.whl.
File metadata
- Download URL: logmagix-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e2eda961bce416ac1b2b8c7f7c0bb82d1e30602cd247a9abab913e5852617ac
|
|
| MD5 |
ed932885a34d7644935c139fdbc91144
|
|
| BLAKE2b-256 |
d9f3d4d0c630f6bc2edd01f15af11813d7d490703f1480663fc9605d5e83a430
|