Please see the Examples - Datalogger for an example program that uses the Datalogger system.
An example for the new file based Datalogger can be found on the documentation for logWriteRaw.