Simple C logging to a stream or file