Skip to main content

Simple, performant logging with ANSI colors for Python.

Project description

ezlogger

Simple, performant logging with ANSI colors for Python.

  • 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 -e .

Usage

from ezlogger import EzLog, log

# Default instance (debug off in production via ENV=production)
log.success("Application started")
log.info("Environment: dev")
log.w("Warning")
log.e("Error")
log.d("Debug")

# Custom config
logger = EzLog({
    "levels": {"error": True, "warn": True, "info": True, "success": True, "debug": False},
    "useColors": True,
    "useLevels": True,
    "useSymbols": False,
    "useTimestamp": True,
})
logger.configure({"useTimestamp": False})

# Objects and errors
log.info("User:", {"id": 1, "name": "John"})
log.error("Failed", Exception("Connection failed"))

# Error handler for routers (e.g. FastAPI/Starlette)
from ezlogger import create_error_handler
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
  • log – default instance (debug off when ENV=production)
  • create_error_handler(is_http_error=..., get_method=..., get_url=...) – for router error callbacks
  • Types: LogLevel, LogColors, EzlogConfig, 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.0.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.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ezlog_py-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 3b1717d6b3df0cc397ea5148c69ea266f3ffeacebb13d7160a7bac63ed484721
MD5 99c08f271978c0b3076c2c4e20b81a47
BLAKE2b-256 1b56c1adf28e052e1d6d645becae4becb5ec2bccdf2aa72303fb5baeab125c2a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ezlog_py-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb168e9fe48706e5739a45145bb921df23f3280cfda3178822321305e3d298be
MD5 fa5456aa9281d5ea430097c2e368c484
BLAKE2b-256 1224d9755b15e2ce93b0557e5e907e14b1ea3e9b3f16bd15c9cc0c6779f9925d

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