Log to USB drive on Portenta Machine Control?

I would like to write log files (ideally CSVs) to a USB flash drive over the USB-A port on the Portenta Machine Control. Can anyone provide a working example, or point me in the right direction?

I have tried working from the USBHost example and the mbed USB mass storage device documentation, but both are somewhat opposite to what I'm trying to achieve.