pyloggy

A tiny, dependency-free Python logger for clean CLI output. It gives you readable level prefixes, optional icons, ANSI colors, and simple style presets without pulling in heavy frameworks.

No dependencies TTY-aware formatting Reusable package API GitHub Pages docs

What It Does

Install & Use

Install

pip install "git+https://github.com/SamuelDBines/pyloggy.git"

Quick Start

from loggy import Log

log = Log(debug=True, verbose=True, style="cli")
log.log("Starting")
log.info("Loading config")
log.ok("Ready")
log.warn("Cache is stale")
log.err("Connection failed")

How It Works

Color Setup

Built-in levels map to straightforward semantic colors:

OKgreen
Infoblue/cyan
Warnorange
Errorred

For fully plain output in CI or redirected logs, set NO_COLOR=1. To force colors in non-TTY environments, set FORCE_COLOR=1.

Config Builder

Pick your setup and generate copy/paste code.

Truecolor preference sets terminal env hints (`COLORTERM=truecolor` on Linux/macOS, safe defaults on Windows). Color pickers generate `hex_to_ansi(...)` overrides in Python.

Code updates live as you edit.

Reusable Package API

from loggy import (
    Log, LogStyle, STYLES, get_style,
    Stopwatch, ProgressTracker, ProgressSnapshot, time_call,
)

Start with a preset and override only what you need:

from loggy import Log, get_style

style = get_style("cli", warn_label="[warning]", warn_icon="⚠")
log = Log(style=style)

Timer + Progress Example

from loggy import ProgressTracker, Stopwatch

with Stopwatch() as sw:
    tracker = ProgressTracker(total=3)
    for _ in range(3):
        tracker.advance()
        print(tracker.render(width=12))

print("done in", Stopwatch.format_seconds(sw.elapsed))

See the repository README for complete package docs and publishing workflow.