Add FormatString function and minor log updates.