<commit_before><?php
	#
	# $Id$
	#

	$GLOBALS[log_colors] = array(
		'db'		=> '#eef',
		'smarty'	=> '#efe',
		'http'		=> '#ffe',
	);

	function log_fatal($msg){

		die("FATAL ERROR: ".$msg);
	}

	function log_error($msg){
		if (!$_GET[debug]) return;

	}
	
	function log_notice($type, $msg, $time=-1){
		if (!$_GET[debug]) return;


		$color = $GLOBALS[log_colors][$type] ? $GLOBALS[log_colors][$type] : '#eee';

		echo "<div style=\"background-color: $color; margin: 1px 1px 0 1px; border: 1px solid #000; padding: 4px; text-align: left\">";

		echo "$msg";
		if ($time > -1){
			echo " ($time ms)";
		}

		echo "</div>\n";
	}

?><commit_msg>pulling in kellan's log stuff<commit_after><?php
	#
	# $Id$
	#

	$GLOBALS[lib_log_colors] = array(
		'db'		=> '#eef',
		'smarty'	=> '#efe',
		'http'		=> '#ffe',
	);

	$GLOBALS[lib_log_handlers] = array(
		'notice'	=> array('html'),
		'error'		=> array('error_log'),
	);
	
	function log_fatal($msg){
		die("FATAL ERROR: ".$msg);
	}

	function log_error($msg){
		_log_dispatch('error', $msg);
	}
	
	function log_notice($type, $msg, $time=-1){
		_log_dispatch('notice', $msg, array(type => $type, time => $time));
	}
	
	
	function _log_dispatch($level, $msg, $more = array()) {
		if ($GLOBALS[lib_log_handlers][$level]) {
			foreach ($GLOBALS[lib_log_handlers][$level] as $handler) {
				call_user_func("_log_handler_$handler", $level, $msg, $more);
			}
		}
	}
	
	function _log_handler_error_log($level, $msg, $more = array()) {
		$page = $GLOBALS[HTTP_SERVER_VARS][REQUEST_URI];
		
		if ($more[type]) {
			$msg = "[$more[type]] $msg";
		}
		
		$msg = str_replace("\n", ' ', $msg);
		
		error_log("[$level] $msg ($page)");
	}
	
	function _log_handler_html($level,$msg, $more = array()) {
		if (!$_GET[debug]) return;
		
		$type = $more[type] ? $more[type] : '';
		
		$color = $GLOBALS[log_colors][$type] ? $GLOBALS[lib_log_colors][$type] : '#eee';

		echo "<div style=\"background-color: $color; margin: 1px 1px 0 1px; border: 1px solid #000; padding: 4px; text-align: left\">";

		if ($type) {
			$msg = "[$type] $msg";
		}
		
		echo "$msg";
		if ($more[time] > -1){
			echo " ($more[time] ms)";
		}

		echo "</div>\n";
		
	}
?>
{'fraction_non_alphanumeric': 0.2304147465437788, 'fraction_numerical': 0.010138248847926268, 'mean_word_length': 3.867713004484305, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 21, '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': '5068248', 'n_tokens_mistral': 998, 'n_tokens_neox': 884, 'n_words': 176}