write to file, custom formatter