/** * Creates a singleton DataLogger or returns the already created object. Before writing to a file * first openWriter() must be called. * * @return The singleton object. */ public static DataLogger getInstance() { if (singletonInstance == null) { singletonInstance = new DataLogger(); singletonInstance.mFileName = "ProbeLog_" + new Date().getTime(); singletonInstance.openWriter(); } return singletonInstance; }
public void createNewLogFile() { mFileName = "ProbeLog_" + new Date().getTime(); closeWriter(); openWriter(); }
/** * Creates a new BufferedWriter with the filename ProbeLog_{current Date in nanoseconds} as .txt * file or does nothing if BufferedWriter is already open. Must be called before writing to a * file. */ public void openLogger() { openWriter(); }