LogResult backend.

Pulled this out of api so we can reuse elsewhere.