Site logo

Log

Error log function

function ErrorLog(text) {
	var file = new File("~/Desktop/" + scriptName + " - error log.txt");
	file.encoding = "UTF-8";
	
	if (file.exists) {
		file.open("e");
		file.seek(0, 2);
	}
	else {
		file.open("w");
		if (errorsArr.length == 0) file.write("=========================================================\rDate & time: " + GetDate() + "\r=========================================================\r");
	}

	file.write(text + "\r"); 
	file.close();
	errorsArr.push(text);
}

 

See also Logging with a smile