ApexTrace
Auto-prefixed structured logs and path assertions for tests. A lightweight lifecycle tracer for the Apex Stem Usecase layer.
What ApexTrace Gives You
A Tiny Library, Two Things
Structured Logs Without Boilerplate
Declare Trace.of('process name') once as an instance field of your Usecase, and every log emitted by t.start() / t.log(...) / t.skip(...) / t.finish(...) gets that name auto-prefixed. Start and end boundaries are emitted automatically too. A mechanism that replaces scattered System.debug calls with a structured form.
Verify Which Path the Code Took
TraceFlow.isLastFinish() / isLastSkip() / isLastAbort() let tests verify which exit path a Usecase took. Even when invoke() returns void, you can pin down behavior along two axes: side effects and control flow.
ApexTrace is intentionally small. It is one of the four OSS that make up Apex Stem, alongside ApexEloquent / ApexBlueprint / ApexTools.
Ready to dive in?
The developer guide walks through the four lifecycle methods, TraceFlow, nesting, and the two execution modes — all in a single pass.