Adapt log writing to work with StringIO