<NME> logger.js
<BEF> var homeDirectory = "Framer Inventory"
var testsDirectory = "/tests"



/*
 App Store:
 /Users/TillluR/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Caches/Framer Inventory/

 3.4.4:
/Users/TillluR/Library/Caches/Framer Inventory/
	var folderName = createTempFolderNamed(homeDirectory)
	var tests = createTempFolderNamed(homeDirectory + testsDirectory)
	var text = readTextFromFile("" + tests + "/" + fileName + ".txt")
	if (text == nil) { log("No test found: " + fileName) }
	return text
}

	return text
}

var writeTestingLog = function(outputString) {
	var folderName = createTempFolderNamed(homeDirectory)
	writeTextToFile(outputString, folderName + "/testsResults.txt")
	if (showLog) { log("Have written to: " + folderName + "/testsResults.txt") }
}

var writeUserDefaults = function(outputString) {
	var folderName = createTempFolderNamed(homeDirectory)
	writeTextToFile(outputString, folderName + "/userDefaults.txt")
}

var writeFailedTest = function(outputString, number) {
	var folderName = createTempFolderNamed(homeDirectory + "/failed")
	writeTextToFile(outputString, folderName + "/test" + (++number) + ".txt")
}




var getTempFolderPath = function(withName) {
    var fileManager = [NSFileManager defaultManager],
    cachesURL = [[fileManager URLsForDirectory:NSCachesDirectory inDomains:NSUserDomainMask] lastObject],
    withName = (typeof withName !== 'undefined') ? withName : (Date.now() / 1000),
    folderName = [NSString stringWithFormat:"%@", withName];
    return [[cachesURL URLByAppendingPathComponent:folderName] path];
}

var createFolderAtPath = function(pathString) {
    var fileManager = [NSFileManager defaultManager];
    if([fileManager fileExistsAtPath:pathString]) return true;
    return [fileManager createDirectoryAtPath:pathString withIntermediateDirectories:true attributes:nil error:nil];
}

var createTempFolderNamed = function(name) {
    var tempPath = getTempFolderPath(name);
    createFolderAtPath(tempPath);
    return tempPath;
}

var writeTextToFile = function(text, filePath) {
    var t = [NSString stringWithFormat:@"%@", text],
    f = [NSString stringWithFormat:@"%@", filePath];
    return [t writeToFile:f atomically:true encoding:NSUTF8StringEncoding error:nil];
}

var readTextFromFile = function(filePath) {
    var fileManager = [NSFileManager defaultManager];
    if([fileManager fileExistsAtPath:filePath]) {
        return [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
    }
    return nil;
}

<MSG> Testing Class fixes

- One export page -> [Framer Inventory]
- Every time export page is cleaned

<DFF> @@ -12,7 +12,9 @@ var readFileForAnswer = function(fileName) {
 	var folderName = createTempFolderNamed(homeDirectory)
 	var tests = createTempFolderNamed(homeDirectory + testsDirectory)
 	var text = readTextFromFile("" + tests + "/" + fileName + ".txt")
-	if (text == nil) { log("No test found: " + fileName) }
+	if (text == nil) {
+		if (showLog) { log("No test found: " + fileName) }
+	}
 	return text
 }
 

Testing Class fixes