Skip to main content

Simple, performant logging with ANSI colors for Python.

Project description

ezlog (Python)

Simple, performant logging with ANSI colors for Python.
Published on PyPI as ezlog-py (import as ezlog).

  • 5 levels: error, warn, info, success, debug
  • Short aliases: e, w, i, s, d
  • ANSI colors: red, yellow, cyan, green, magenta
  • Config: levels on/off, colors, symbols vs text, timestamp
  • Safe serialization: circular refs, dates, exceptions
  • Zero dependencies

Install

pip install ezlog-py

Usage

from ezlog import EzLog, create_error_handler

# Create your own logger (no pre-initialized log instance)
logger = EzLog({
    "levels": {"error": True, "warn": True, "info": True, "success": True, "debug": False},
    "useColors": True,
    "useLevels": True,
    "useSymbols": False,
    "useTimestamp": True,
})
logger.success("Application started")
logger.info("Environment: dev")
logger.w("Warning")
logger.e("Error")
logger.d("Debug")

logger.configure({"useTimestamp": False})
logger.info("User:", {"id": 1, "name": "John"})
logger.error("Failed", Exception("Connection failed"))

# Error handler for routers (e.g. FastAPI/Starlette)
on_error = create_error_handler()
on_error(exception, request)

Config

Option Description
levels Enable/disable per level
useColors ANSI colors on/off
useLevels Show level label before message
useSymbols Use symbols (x, !, i, ✓, d) or text
useTimestamp ISO timestamp before message

Exports

  • EzLog – logger class (create instances yourself)
  • create_error_handler(is_http_error=..., get_method=..., get_url=...) – for router error callbacks
  • Types: LogLevel, LogColors, EzlogConfig, LevelsConfig, LevelConfig, LogArgs, ConsoleMethod

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

ezlog_py-1.0.1.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

ezlog_py-1.0.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file ezlog_py-1.0.1.tar.gz.

File metadata

  • Download URL: ezlog_py-1.0.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ezlog_py-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d59ba5e968b2e264d6647a51818e7d78ffd120cfa517c55e9f659ba4c9e3d5c1
MD5 0b7484c2cec03880facd72ec3afaadee
BLAKE2b-256 d422042a1a6b20d6343c5ee31dd2148baa7a569d73fb49047e5357096c855d89

See more details on using hashes here.

File details

Details for the file ezlog_py-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: ezlog_py-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ezlog_py-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ac2baaa58a7f1eaaa66cbf8cb93fb71d0c83dc694e444ea5920524b87117c466
MD5 4d381da0a158cdf841509f73d82e968d
BLAKE2b-256 a5ea73ac36b85ee428c375ac99750c27ff6b4cd9d8982917f33582e77ebe432e

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