Install & Compatibility
Where this runs
tested against v1.6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.930 runs
installs and imports cleanly · install 0.0s · import 0.029s · 17.9MB
glibcpy 3.10–3.930 runs
installs and imports cleanly · install 1.6s · import 0.026s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
get_logger
✓ from cpylog import get_logger
basic_config
✓ from cpylog.config import basic_config
HTMLFileHandler
✓ from cpylog import HTMLFileHandler
ColorFormatter
✓ from cpylog.formatters import ColorFormatter
This quickstart demonstrates how to set up `cpylog` for console output using `basic_config` and then add an `HTMLFileHandler` to simultaneously log messages to an HTML file. It covers different logging levels.
from cpylog.config import basic_config
from cpylog import get_logger, HTMLFileHandler
import os
# Configure basic logging to console (INFO level by default)
basic_config()
logger = get_logger("my_app")
logger.info("This is an informational message to console.")
logger.warning("A warning message.")
# Configure and add an HTML file handler
html_handler = HTMLFileHandler("app_log.html")
logger.addHandler(html_handler)
logger.info("This message will go to console and app_log.html.")
logger.error("An error occurred, see details in HTML file.")
# To demonstrate basic logging with different levels
logger.debug("This is a debug message (won't show by default with basic_config).")
logger.critical("Critical error! System might be down.")
print("Check app_log.html for HTML output.")
# Clean up the generated file (optional, for demonstration)
# try:
# os.remove("app_log.html")
# except OSError:
# pass
Debug
Known issues
gotchacpylog implements its own logging interface (`cpylog.get_logger`) and configuration (`cpylog.config.basic_config`) which, while inspired by, are not fully compatible with Python's standard `logging` module. Direct interoperability or assumption of standard `logging` module behavior may lead to unexpected results.fixAlways use `cpylog`'s provided functions and classes (e.g., `cpylog.get_logger`, `cpylog.HTMLFileHandler`) for configuration and logging. Do not mix `cpylog`'s objects directly with `logging` module objects unless explicitly designed to bridge them.
affects: All versions
gotchaFeatures like colorful console output (using `ColorFormatter`) and syntax-highlighted HTML output (using `HTMLFileHandler` or `HTMLStreamHandler`) require optional dependencies (`colorama` and `pygments` respectively) which are not installed by default with `pip install cpylog`.fixInstall the required optional dependencies using `pip install cpylog[color]` for color, `pip install cpylog[html]` for HTML, or `pip install cpylog[color,html]` for both.
affects: All versions
gotchaThe `cpylog` library has not seen active development since its last release in 2021. While stable, new features or prompt bug fixes are unlikely. Consider this if integrating into a long-term project requiring active maintenance or cutting-edge features.fixAssess if the current feature set meets your needs. For projects requiring continuous updates, consider more actively maintained logging solutions like standard `logging` with external formatters (e.g., `rich`) or dedicated logging frameworks.
affects: 1.6.0 and earlier
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'cpylog'
The `cpylog` library has not been installed in the current Python environment.
fixInstall the library using pip: `pip install cpylog`
ModuleNotFoundError: No module named 'colorama'
`colorama` is an optional dependency required for colorful console output and was not installed.
fixInstall `cpylog` with the color extra: `pip install cpylog[color]`
ModuleNotFoundError: No module named 'pygments'
`pygments` is an optional dependency required for HTML output and was not installed.
fixInstall `cpylog` with the html extra: `pip install cpylog[html]`
Upgrade
Version history
1.6.0latest on PyPI · released Jun 15, 2025
Audit
Dependencies
coloramaoptionalRequired for colorful console output, if the ColorFormatter is used.
pygmentsoptionalRequired for generating syntax-highlighted HTML output, if an HTML handler is used.