Skip to main content

python-coloured-logger

A lightweight Python package that provides clean, coloured logging output for Flask, FastAPI, and any standard Python application.

It extends Python’s built-in logging module with readable coloured console output and simple setup helpers.

Support me on Ko-fi


Features

  • Coloured console logging
  • Works with standard Python logging
  • Flask integration
  • FastAPI / Uvicorn integration
  • Simple setup API
  • Lightweight with minimal configuration

Installation

Install from PyPI:

pip install python-coloured-logger

Quick Start

from coloured_logger import get_logger

logger = get_logger("my-app")

logger.debug("Debug message")
logger.info("Server started")
logger.success("Database connected")
logger.warning("High memory usage")
logger.error("Request failed")
logger.critical("System crash")

Example output:

[20/06/2026] [INFO] Server started
[20/06/2026] [SUCCESS] Database connected
[20/06/2026] [WARNING] High memory usage
[20/06/2026] [ERROR] Request failed

Flask Integration

from flask import Flask
from coloured_logger import setup_logging

app = Flask(__name__)

setup_logging(logger_name="flask.app")

@app.route("/")
def index():
    app.logger.info("Request received")
    return "Hello World"

FastAPI Integration

from fastapi import FastAPI
from coloured_logger import setup_logging

app = FastAPI()

setup_logging(logger_name="uvicorn")

@app.get("/")
async def root():
    return {"message": "Hello World"}

Standard Python Logging

from coloured_logger import setup_logging
import logging

setup_logging()

logger = logging.getLogger("example")

logger.info("Using standard logging")

Environment Variables

Enable or Disable Colours

By default, colours are enabled.

COLOURED_LOGGER_COLOR=True

or for Flask-specific configuration:

FLASK_LOG_COLOR=True

Disable colours:

COLOURED_LOGGER_COLOR=False

Custom Date Format

COLOURED_LOGGER_DATE_FORMAT=%Y-%m-%d %H:%M:%S

or:

FLASK_LOG_DATE_FORMAT=%H:%M:%S

Supported Log Levels

Level Description
debug Debug information
info General information
success Successful operations
warning Warning messages
error Error messages
critical Critical failures

Requirements

  • Python 3.8+
  • Flask (optional)
  • FastAPI / Uvicorn (optional)

License

MIT License


Contributing

Pull requests, issues, and suggestions are welcome.

If you find a bug or want to improve the package, feel free to open an issue or submit a PR.


  • PyPI: https://pypi.org/project/python-coloured-logger/
  • GitHub: https://github.com/Skulldorom/python-coloured-logger

Release files for python-coloured-logger 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-coloured-logger 1.0.5
File Size Uploaded
python_coloured_logger-1.0.5.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-coloured-logger 1.0.5
File Interpreter ABI Platform
python_coloured_logger-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / python_coloured_logger-1.0.5.tar.gz

Download URL python_coloured_logger-1.0.5.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2f95466bbd7f5d9bf6081414c7a1a480288978983fa053eab6176e4800c152fc
BLAKE2b-256 checksum
How to use checksums
fdccc119c44bcb7913a1f2735f5c168cd9d77939cb4d41d3e2a2e8219ef921a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.

Transparency log

Release files / python_coloured_logger-1.0.5-py3-none-any.whl

Download URL python_coloured_logger-1.0.5-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c0df547901b2cc79aa99fc57e297efdf1edecf80944c8435c5c208db9a6c84b
BLAKE2b-256 checksum
How to use checksums
98bf8f01bbdb99d543639459c496b6e8574fd54ab8f6136d5e816041e5d594dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page