How platformlab/nanolog works
NanoLog is a C++ logging system that records dynamic arguments in a compact binary log and defers human-readable formatting to decompression. Its two usage paths are the C++17 API and the compile-time preprocessor; both serve application logging, followed by runtime capture and offline decoding. The README documents this overall pipeline, while source excerpts are partial, so internal wiring not established by the evidence is omitted.
Main entry points: RuntimeLogger.cc Runtime Logger · LogDecompressor.cc Decompressor · GeneratedCode.h Generated Code · NanoLogCpp17.h C++17 API
Components 12
Logging APIs
- C++17 API
runtime/NanoLogCpp17.h - Log Parser
preprocessor/parser.py - Code Generator
preprocessor/FunctionGenerator.py - Generated Code
runtime/GeneratedCode.h
Runtime Capture
- Runtime Logger
runtime/RuntimeLogger.cc - Log Codec
runtime/Log.cc - Binary Log
Offline Decoding
- Decompressor
runtime/LogDecompressor.cc - Readable Log
Runtime Support
- Log Configuration
runtime/Config.h - Cycle Timing
runtime/Cycles.cc
Other components
- C++ Application
Connections 14
- C++ Application → C++17 API: logs through
- C++ Application → Log Parser: preprocesses source
- Log Parser → Code Generator: generates code
- Code Generator → Generated Code: emits logging code
- C++ Application → Generated Code: logs through
- C++17 API → Runtime Logger: records messages
- Generated Code → Runtime Logger: records messages
- Runtime Logger → Log Codec: encodes entries
- Runtime Logger → Binary Log: writes binary log
- Binary Log → Decompressor: reads binary log
- Decompressor → Log Codec: decodes entries
- Decompressor → Readable Log: formats output
- Runtime Logger → Log Configuration: reads settings
- Runtime Logger → Cycle Timing: timestamps entries