Logging directly to the flash drive is not advised because if the file being written to is not closed properly, the flash drive can get corrupt and unusable. Attached is a sample program that logs data to a file. It logs data to the PAC and then copies to the USB flash drive.
PAM 1.4: Data_To_File_PAM1.4
PAM 1.2: Data_To_File_PAM1.2