clog
Minimal C89 logging library for Classic Mac and modern systems
clog is a small logging library written in strict C89 that works on both POSIX systems and Classic Macintosh. It provides 8 functions and 4 macros for logging at different severity levels, with timestamps and level tags in the output. The whole thing is 545 lines and uses about 310 bytes on POSIX, 440 bytes on Classic Mac.
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
# Features
- 8 functions and 4 logging macros (ERR, WARN, INFO, DEBUG)
- Static allocation only, no heap, safe for constrained environments
- POSIX output to stderr or file with gettimeofday() timestamps
- Classic Mac output to File Manager text file with TickCount() timestamps
- Compile-time level stripping via CLOG_STRIP and CLOG_MIN_LEVEL
- Network sink callback for remote log collection from Classic Macs
- Configurable flush modes: none (fastest), all (crash-safe), or errors-only
# Tech Stack
# Dependency Chain
clog is the foundation of the Classic Mac networking stack:
Retro68 -> clog -> peertalk -> csend, BomberTalk
Retro68 provides the cross-compiler and MPW Interfaces. clog provides logging. PeerTalk uses clog for debugging and provides the networking SDK. CSend and BomberTalk both build on top.
# Development approach
The repository uses SpecKit for specification-driven development. GitHub Actions runs CI on every push, building the library and running the test suite.