<commit_before>var Spaz; if (!Spaz) Spaz = {};

/***********
Spaz.Debug
************/
if (!Spaz.Debug) Spaz.Debug = {};

Spaz.Debug.enable = function() {
	Spaz.Prefs.set('debug-enabled', true);
};

Spaz.Debug.disable = function() {
	Spaz.Prefs.set('debug-enabled', false);
};

Spaz.Debug.setEnable = function(state) {
	if (state) {
		Spaz.Debug.enable();
	} else {
		Spaz.Debug.disable();
	}
};

Spaz.Debug.dump = function(msg, type) {
	if ( Spaz.Prefs && Spaz.Prefs.get('debug-enabled') ) {
		
		if (!type) {
			type = 'info';
		}

		if (air.Introspector && air.Introspector.Console && air.Introspector.Console[type]) {
			air.Introspector.Console[type](msg);
		} else {
			sch.dump(msg);
		}
	
		Spaz.Debug.logToFile(msg);
	}
}


Spaz.Debug.logToFile = function(msg) {
	var cr = air.File.lineEnding;
	var file   = air.File.documentsDirectory;
	file       = file.resolvePath("spaz-debug.log");
	var stream = new air.FileStream();
	stream.open(file, air.FileMode.APPEND);
	now = new Date();
	stream.writeUTFBytes(now.toString() + ' : ' + msg + cr);
	stream.close();
}


// Spaz.Debug.dump = function(msg, type) {
// 
// }


// alias
sch.debug = function(msg, type) {
	Spaz.Debug.dump(msg, type);
}
<commit_msg>Spaz.Debug.Dump was circular reference<commit_after>var Spaz; if (!Spaz) Spaz = {};

/***********
Spaz.Debug
************/
if (!Spaz.Debug) Spaz.Debug = {};

Spaz.Debug.enable = function() {
	Spaz.Prefs.set('debug-enabled', true);
};

Spaz.Debug.disable = function() {
	Spaz.Prefs.set('debug-enabled', false);
};

Spaz.Debug.setEnable = function(state) {
	if (state) {
		Spaz.Debug.enable();
	} else {
		Spaz.Debug.disable();
	}
};

Spaz.Debug.dump = function(msg, type) {
	if ( Spaz.Prefs && Spaz.Prefs.get('debug-enabled') ) {
		
		if (!type) {
			type = 'info';
		}

		if (air.Introspector && air.Introspector.Console && air.Introspector.Console[type]) {
			air.Introspector.Console[type](msg);
		} else {
			sch.dump(msg);
		}
	
		Spaz.Debug.logToFile(msg);
	}
}


Spaz.Debug.logToFile = function(msg) {
	var cr = air.File.lineEnding;
	var file   = air.File.documentsDirectory;
	file       = file.resolvePath("spaz-debug.log");
	var stream = new air.FileStream();
	stream.open(file, air.FileMode.APPEND);
	now = new Date();
	stream.writeUTFBytes(now.toString() + ' : ' + msg + cr);
	stream.close();
}


{'fraction_non_alphanumeric': 0.20768566493955096, 'fraction_numerical': 0.0, 'mean_word_length': 3.606361829025845, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '198816', 'n_tokens_mistral': 949, 'n_tokens_neox': 897, 'n_words': 142}