Implementing a singleton class.

As an Arduino (normally) has only one thread, does your class really need to be a singleton? It is no multitasking environment where different objects run in different threads. so ...

wrt the class,

  • add the filename to the constructor That enables you to have different loggings (different sketches) on the same SDcard.
  • add a flag to writeline indicating type of log; use an enum LEVEL { DEBUG, INFO, WARNING, ERROR, MAYDAY }
  • add a timestamp before every string (prefered from a RTC if available)

reader - Singleton pattern - Wikipedia