{"id":9626,"library":"cpylog","title":"Colorama/HTML Capable Logger","description":"cpylog is a simple, pure Python logging library designed to provide colorful console output using Colorama and rich HTML output capabilities (via Pygments). It offers a straightforward API to configure and manage loggers with various handlers and formatters. The current version is 1.6.0. The library appears to be in maintenance mode, with its last release in 2021, indicating a stable but not actively developed project.","status":"maintenance","version":"1.6.0","language":"en","source_language":"en","source_url":"https://github.com/ddupoiron/cpylog","tags":["logging","color","html","logger","colorama","pygments"],"install":[{"cmd":"pip install cpylog","lang":"bash","label":"Core library"},{"cmd":"pip install cpylog[color]","lang":"bash","label":"With colorama for console coloring"},{"cmd":"pip install cpylog[html]","lang":"bash","label":"With pygments for HTML output"}],"dependencies":[{"reason":"Required for colorful console output, if the ColorFormatter is used.","package":"colorama","optional":true},{"reason":"Required for generating syntax-highlighted HTML output, if an HTML handler is used.","package":"pygments","optional":true}],"imports":[{"symbol":"get_logger","correct":"from cpylog import get_logger"},{"symbol":"basic_config","correct":"from cpylog.config import basic_config"},{"symbol":"HTMLFileHandler","correct":"from cpylog import HTMLFileHandler"},{"symbol":"ColorFormatter","correct":"from cpylog.formatters import ColorFormatter"}],"quickstart":{"code":"from cpylog.config import basic_config\nfrom cpylog import get_logger, HTMLFileHandler\nimport os\n\n# Configure basic logging to console (INFO level by default)\nbasic_config() \n\nlogger = get_logger(\"my_app\")\nlogger.info(\"This is an informational message to console.\")\nlogger.warning(\"A warning message.\")\n\n# Configure and add an HTML file handler\nhtml_handler = HTMLFileHandler(\"app_log.html\")\nlogger.addHandler(html_handler)\nlogger.info(\"This message will go to console and app_log.html.\")\nlogger.error(\"An error occurred, see details in HTML file.\")\n\n# To demonstrate basic logging with different levels\nlogger.debug(\"This is a debug message (won't show by default with basic_config).\")\nlogger.critical(\"Critical error! System might be down.\")\n\nprint(\"Check app_log.html for HTML output.\")\n\n# Clean up the generated file (optional, for demonstration)\n# try:\n#     os.remove(\"app_log.html\")\n# except OSError:\n#     pass\n","lang":"python","description":"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."},"warnings":[{"fix":"Always 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.","message":"cpylog 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Install 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.","message":"Features 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`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Assess 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.","message":"The `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.","severity":"gotcha","affected_versions":"1.6.0 and earlier"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Install the library using pip: `pip install cpylog`","cause":"The `cpylog` library has not been installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'cpylog'"},{"fix":"Install `cpylog` with the color extra: `pip install cpylog[color]`","cause":"`colorama` is an optional dependency required for colorful console output and was not installed.","error":"ModuleNotFoundError: No module named 'colorama'"},{"fix":"Install `cpylog` with the html extra: `pip install cpylog[html]`","cause":"`pygments` is an optional dependency required for HTML output and was not installed.","error":"ModuleNotFoundError: No module named 'pygments'"}]}