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:

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.1.tar.gz (4.1 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.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

Hashes for logmagix-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c373bee6aeae5b0abda99fbde0697bc7424ddf216eb5cba76e3c88317702400b
MD5 4b3801db133fd2e0237fd43ec402cb1b
BLAKE2b-256 1b1bb6b0c6272c5a86b33da5771005208c2e62d33b4e983a9130603b4d46c948

See more details on using hashes here.

File details

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

File metadata

  • Download URL: logmagix-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for logmagix-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a550f939c6a1ee90aa33ad1b30576010efa181683ead4cf22d5da481c9030c7f
MD5 bf48fede206561e57312a0b604f327f9
BLAKE2b-256 6ac4e2a2b925c2f06b827328f534dc1cf12b8651b33da1af364c972a7c18cd1d

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