Save to SD card if no cloud connection

I’m trying to find a way to save the events to an SD card when cloud connection is lost and once reestablish publish those events. I looked at this https://github.com/rickkas7/PublishQueueAsyncRK/blob/master/more-examples/SdFatExample/src/SdFatExample.cpp

Am I just to add this code

#include "SdFat.h"
#include "PublishQueueAsyncRK.h"

const int SD_CHIP_SELECT = A2;

SdFat sdCard;

PublishQueueAsyncSdFat publishQueue(sdCard, "events.dat");
if (sdCard.begin(SD_CHIP_SELECT, SPI_FULL_SPEED)) {
		publishQueue.setup();
	}
	else {
		Log.info("failed to initialize sd card");
	}

and use publishQueue.publish instead of Particle.publish()?

There are examples in the example folder on GitHub, I am currently trying to get those examples to work on a Boron.

I am using a SparkFun microSD Transflash Breakout wired like this:
(SD - BORON):
DI - D12 (MO)
DO - D11 (MI)
SCK - D13 (SCK)
CS - A2
GND - GND
3v3 - VCC

However I am having SD Card init issues, serial log as follows:

Serial monitor opened successfully:
0000009890 [hal] INFO: Using internal SIM card
0000011062 [app] INFO: failed to initialize sd card

Have you tried to use the example sketch on the GitHub repo?

EDIT: The Sd card seems to be working now. I just had to reformat the SD to FAT32

@rickkas7
Hi Rick, I know this is a stupid question but how do I actually use the test commands for this app?

particle call electron3 test "1,10000"

Should the above commands be passed via serial, or should they be placed somewhere in the app code?

Just realised its a CLI command, just call the function from the CLI. Very cool library Rick, I think it will really help our application.