Skip to main content

Add your description here

Project description

logger4me

img1

A simple and colorful Python logging utility that provides enhanced console output with ANSI color codes and flexible file logging options.

Features

  • Colorful Console Output: Different log levels are displayed in different colors for better readability
  • File Logging Support: Optional file logging with customizable file paths
  • Color Control: Choose whether to save colors in log files or keep them plain text
  • Flexible Log Levels: Support for all standard Python logging levels (DEBUG, INFO, WARNING, ERROR, CRITICAL)
  • Easy Integration: Simple one-function setup for your logging needs

Installation

Install logger4me using pip:

pip install logger4me

Usage

Basic Usage

from logger4me import get_logger

# Create a logger with default settings
logger = get_logger()

# Log messages at different levels
logger.debug("This is a debug message")
logger.info("This is an info message")
logger.warning("This is a warning message")
logger.error("This is an error message")
logger.critical("This is a critical message")

Advanced Configuration

from logger4me import get_logger
import logging

# Create a logger with custom settings
logger = get_logger(
    level = 10,        # Set minimum log level
    log_file = './logs/app.log',  # Save logs to file
    save_color = False            # Don't save ANSI colors to file
)

Parameters

  • level (int): Minimum logging level (default: logging.INFO)

    • 10: Debug messages and above(logging.DEBUG)
    • 20: Info messages and above(logging.INFO)
    • 30: Warning messages and above(logging.WARNING)
    • 40: Error messages and above(logging.ERROR)
    • 50: Critical messages only(logging.CRITICAL)
  • log_file (str, optional): Path to save log messages to a file (default: None)

    • If provided, creates the directory structure automatically
    • File is created in write mode, overwriting existing content
  • save_color (bool): Whether to save ANSI color codes in the log file (default: False)

    • True: Colors are preserved in the file
    • False: Plain text without color codes (recommended for file logs)

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

logger4me-0.1.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file logger4me-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: logger4me-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for logger4me-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af7724cc12b0b740cb63c5149da27a6d639c7b692912fd3d82ee03dd0aa5a94d
MD5 962aed7b476897ab51f4d91343b2ed31
BLAKE2b-256 26420943f1c020243a2a2f8c56b85b6f2bb57281099a15c1c923b10c2173f85b

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