The Library

clog is a small logging library written in strict C89 that works on both POSIX systems and Classic Macintosh. It provides 6 functions and 4 macros for logging at different severity levels, with timestamps and level tags in the output.

clog_init("MyApp", CLOG_INFO);
CLOG_INFO("Connected to %s", peer_name);
CLOG_ERR("Send failed: %d", err);
clog_shutdown();

Output looks like: [1234][INF] Connected to PlayerTwo

Why Build This

I needed a logging library for my Classic Mac networking projects. Existing options either didn't support the older platforms or pulled in dependencies that wouldn't compile under Retro68. clog uses static allocation only (no heap), stays under 500 lines, and compiles cleanly for 68k, PowerPC, and modern systems.

Platform Support

Platform Output Timestamp
POSIX stderr or file gettimeofday() ms delta
68k Mac File Manager text file TickCount() ms delta
PPC Mac File Manager text file TickCount() ms delta

The library uses about 310 bytes on POSIX and 250 bytes on Classic Mac. No dynamic allocation means it's safe to use in constrained environments where malloc isn't available or desirable.

Development Workflow

The repository uses speckit, a set of Claude Code slash commands for specification-driven development. The workflow starts with /speckit.specify to define what to build, then /speckit.plan to break it into phases, /speckit.tasks to generate implementation tasks, and /speckit.implement to work through them. Each command reads from structured spec files in the specs/ directory.

GitHub Actions runs CI on every push and pull request, building the library and running the test suite.

Dependency Chain

clog is the foundation of my Classic Mac networking stack:

Retro68 -> clog -> peertalk -> csend

Retro68 provides the cross-compiler and MPW Interfaces. clog provides logging. PeerTalk uses clog for debugging and provides the networking SDK. CSend uses both for a working chat application.

Tech Stack

C89 CMake Retro68 68k Mac PowerPC Mac POSIX