Skip to main content

EchoLog: colorful, configurable logging with JSON and rotation

Project description

EchoLog

EchoLog is a modern, colorful logging library for Python with:

  • Color-coded console output
  • Daily log files
  • Global level filtering
  • Optional JSON output
  • Size-based rotation with backups
  • Retention policy by days
  • In-memory ring buffer
  • Custom handlers for integrations (e.g., send to webhook)

Install

pip install echolog

Quick Start

from echolog import Logger, LogLevel

logger = Logger(
    name="MyApp",
    level=LogLevel.INFO,
    color=True,
    log_dir="logs",
    json_output=False,
    rotation={"type": "size", "max_bytes": 1_000_000, "backup_count": 5},
    retention_days=14,
)

logger.info("Application started")
logger.warning("This is a warning")
logger.error("Something failed")

# Change level dynamically
logger.set_level("DEBUG")
logger.debug("Debug details")

# Add a custom handler
logger.add_handler(lambda rec: print("[HOOK]", rec["level"], rec["message"]))

JSON Output

Logger(json_output=True).info("Structured log")

Disable Colors

logger.disable_color()

Read Current Log File

print("Log file:", logger.file_name())
print("Lines:", logger.get_logs()[:5])

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

pyecholog-3.0.3.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

pyecholog-3.0.3-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file pyecholog-3.0.3.tar.gz.

File metadata

  • Download URL: pyecholog-3.0.3.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for pyecholog-3.0.3.tar.gz
Algorithm Hash digest
SHA256 6a7668e030d42c0a6ee2e26a2bcfd1cb9a2ff90d62c8fd1d6864c1b787148de2
MD5 33352057f4574752698d6bcc7aaef75d
BLAKE2b-256 791a891bb09e40dee124e767edfe60d2dbf8cfa26604a2a23b17708b8a299482

See more details on using hashes here.

File details

Details for the file pyecholog-3.0.3-py3-none-any.whl.

File metadata

  • Download URL: pyecholog-3.0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for pyecholog-3.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 01530bb9371743db19e6f8aa2486e2dcfca85b6c4e0f8b6aa0b42bd4777bd290
MD5 935a308c59b50a81fd21fb9ecbc3b951
BLAKE2b-256 d7ed84764275636bfba85d7a98e70a3cd7a98541caf1f5a296f964e5c3d04624

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