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).

  • 6 levels: debug, info, success, warn, error, critical (NOTSET skipped; each with symbol + color)
  • Short aliases: d, i, s, w, e, c
  • ANSI colors: full palette (red, green, yellow, cyan, magenta, blue, white, gray, light-* variants)
  • Stdlib integration: creating an EzLog wires it to stdlib logging automatically
  • Zero dependencies

Install

pip install ezlog-py

Usage

Create a logger; it wires itself to stdlib logging. Use log.i(), log.success(), and anywhere logging.info() / logger.error() also go through ezlog:

from ezlog import EzLog

log = EzLog(use_colors=True, use_timestamp=True)

# Direct ezlog (includes .success() level)
log.success("Application started")
log.i("Hello")
log.w("Warning")
log.e("Error")
log.d("Debug")

# Stdlib logging (wired internally; same formatting)
import logging
logging.info("From stdlib")
logging.error("Failed", exc_info=True)

You can pass a config dict: EzLog({"useColors": True, "useTimestamp": False}) or mix: EzLog({"useColors": True}, use_timestamp=False).

Configuration

Config is an EzlogConfig (partial updates supported):

  • useColors, useLevels, useSymbols, useTimestamp – booleans
  • levels – per-level config: each level is either a LevelConfig or False (to disable)

LevelConfig has symbol, text, color (no consoleFn; output target is fixed by ezlog). You can override defaults or disable a level:

log = EzLog({
    "useColors": True,
    "levels": {
        "info": {"symbol": "I", "text": "Info", "color": "light-cyan"},
        "debug": False,
    },
})

Constants and defaults live in ezlog.defaults (DEFAULT_SYMBOLS_FALLBACK, DEFAULT_TEXTS, DEFAULT_COLORS, COLOR_CODES, etc.); types in ezlog.types.

init (optional)

ezlog.init(use_colors=..., use_timestamp=...) creates an EzLog (wired to stdlib) and sets ezlog.log. Use it if you prefer ezlog.log.i("...") instead of keeping your own log variable.

Levels

Ezlog has 6 levels (severity order): debug, info, success, warn, error, critical.
Each has a default symbol and color (overridable). Stdlib DEBUG/INFO/WARNING/ERROR/CRITICAL map to ezlog; NOTSET is skipped.

Color properties

When colors are enabled, the logger exposes: log.red, log.yellow, log.cyan, log.green, log.magenta, log.white, log.gray, log.reset. Use them for custom formatted messages (use log.reset after colored segments).

Exports

  • EzLog(config?, use_colors?, use_timestamp?) – create logger (wires to stdlib on construction)
  • init(use_colors=..., use_timestamp=...) – optional; sets ezlog.log
  • log – set by init(); use after ezlog.init()
  • Types: LogLevel, LogColors, EzlogConfig, LevelsConfig, LevelConfig, LogArgs, ConsoleMethod
  • Constants (from ezlog.defaults): COLOR_CODES, RESET, DEFAULT_SYMBOLS_FALLBACK, DEFAULT_TEXTS, DEFAULT_COLORS

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.3.tar.gz (7.2 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.3-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ezlog_py-1.0.3.tar.gz
  • Upload date:
  • Size: 7.2 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.3.tar.gz
Algorithm Hash digest
SHA256 0ca6447b2a7c38dff8e8ecd3516f0a77f8d6a87658faf82574a2155cada06e62
MD5 1f4741f016f201f4d8705739507ff828
BLAKE2b-256 3bc45fed2d52b76eef1c498bff2dc4b6acb12691516ee8857f1b32b71333e54b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ezlog_py-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d7864881d5a59c9d8e6f2a756fc36fcc3f29a40e66848ce96e18bef0a7c77b46
MD5 647f1134e74406d224eb7c45931c68db
BLAKE2b-256 8ce26c6b3099559094d697b8041178cc04040d3fd5158cadca516fd79f68e5e1

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