Convert api lib to stream logging

Ruben's contribution to the latest sprint