Skip to main content

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:

```bash
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:

  • colorama for 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


Download files

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

Source Distribution

logmagix-0.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

logmagix-0.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file logmagix-0.1.tar.gz.

File metadata

  • Download URL: logmagix-0.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for logmagix-0.1.tar.gz
Algorithm Hash digest
SHA256 ac403899b9d257b02819fc0925c6481c68e8b54359715c50f0def55eaadeb5e4
MD5 2c43a6b275e2128d709bc56a352be70d
BLAKE2b-256 965a0256e422ae67bc142bd69bb8b3d290dd76e2737a8cb31c6babedc25aa126

See more details on using hashes here.

File details

Details for the file logmagix-0.1-py3-none-any.whl.

File metadata

  • Download URL: logmagix-0.1-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.3

File hashes

Hashes for logmagix-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 615f51dbe5137bb82f4313dbd1654cdddde4a216e6a0b55416905b7c209b8f3e
MD5 7286695b5222a98b71ab43c0e1299d14
BLAKE2b-256 c92a630c660cf56a81231510070544e476a907485bcbc3f3e15e9e3a5f6dae03

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