Simple, performant logging with ANSI colors for Python.
Project description
ezlog
Simple, performant logging with ANSI colors for Python.
Published on PyPI as ezlog-py.
- 6 levels:
debug,info,success,warn,error,critical - Short aliases:
d,i,s,w,e,c - ANSI colors: full palette
- 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, "timestamp": False}) or mix: EzLog({"useColors": True}, use_timestamp=False).
Configuration
Config is an EzlogConfig (partial updates supported):
- useColors, useLevels, useSymbols – booleans
- timestamp –
Falseto disable, orTimestampConfig: format (str, e.g."%Y-%m-%d %H:%M:%S"), color ("as_levels"to use level color, or anyLogColors) - levels – per-level config: each level is either a
LevelConfigorFalse(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 afterezlog.init() - Types:
LogLevel,LogColors,TimestampColor,TimestampConfig,EzlogConfig,LevelsConfig,LevelConfig,LogArgs,ConsoleMethod - Constants (from
ezlog.defaults):COLOR_CODES,RESET,DEFAULT_SYMBOLS_FALLBACK,DEFAULT_TEXTS,DEFAULT_COLORS,DEFAULT_TIMESTAMP_FORMAT,DEFAULT_TIMESTAMP_COLOR,DEFAULT_TIMESTAMP
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ezlog_py-1.0.4.tar.gz.
File metadata
- Download URL: ezlog_py-1.0.4.tar.gz
- Upload date:
- Size: 7.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b3bf21bdf86b5425866d87192dbfcff399331d6f7b95e3a40c0423fef6aeeb2
|
|
| MD5 |
8e49e32fda2e29ce2e8288846c4dfd93
|
|
| BLAKE2b-256 |
ed15b4fbe50a36144a27cfbcdf7b664b6c400915a6715e7ea9bd2635d88012ce
|
File details
Details for the file ezlog_py-1.0.4-py3-none-any.whl.
File metadata
- Download URL: ezlog_py-1.0.4-py3-none-any.whl
- Upload date:
- Size: 9.7 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2cdf9e92ae76196a45940d2d61066c39ea3a606bfd6cefb56235cc22ef1b643
|
|
| MD5 |
1f36a25e8db77c4e3e710e826bc282cb
|
|
| BLAKE2b-256 |
de3d5d917c766e2700d8d8a4cd60936f1d34c9a818a5313ef3d847a6927cf5d7
|