<commit_before>public enum Color {
	OFF = 0, BOLD = 1, UNDERLINE = 4, ESC = 27, RED = 31, YELLOW = 33,
	BLUE = 34, MAGENTA = 35, CYAN = 36, WHITE = 37
}

namespace Log {

	public static void
	info(string fmt, ...)
	{
		Log.all(Color.WHITE, stdout, "INFO ", fmt.vprintf(va_list()));
	}

	public static void
	warn(string fmt, ...)
	{
		Log.all(Color.YELLOW, stdout, "WARN ", fmt.vprintf(va_list()));
	}

	public static void
	debug(string fmt, ...)
	{
		if ((xhp.arg != null) && xhp.arg.debug)
			Log.all(Color.CYAN, stderr, "DEBUG",
			    fmt.vprintf(va_list()));
	}

	public static void
	error(string fmt, ...)
	{
		Log.all(Color.RED, stderr, "ERROR", fmt.vprintf(va_list()));
	}

	public static void
	plain(FileStream *target, string fmt, ...)
	{
		target->vprintf(fmt, va_list());
	}

	public static void
	custom(string name, Color color, string fmt, ...)
	{
		Log.all(color, stdout, name, fmt.vprintf(va_list()));
	}

	public static void
	all(Color color, FileStream *target, string name, string message)
	{
		target->printf("%c[%dm%c[%dm[%s] => %s%c[%dm\n",
		    Color.ESC, Color.BOLD, Color.ESC, color,
		    name, message, Color.ESC, Color.OFF);<commit_msg>log.vala: copy va_list to try and workaround x86_64 problem.<commit_after>public enum Color {
	OFF = 0, BOLD = 1, UNDERLINE = 4, ESC = 27, RED = 31, YELLOW = 33,
	BLUE = 34, MAGENTA = 35, CYAN = 36, WHITE = 37
}

namespace Log {

	public static void
	info(string fmt, ...)
	{
		var l = va_list();
		Log.all(Color.WHITE, stdout, "INFO ",
		    fmt.vprintf(va_list.copy(l)));
	}

	public static void
	warn(string fmt, ...)
	{
		var l = va_list();
		Log.all(Color.YELLOW, stdout, "WARN ",
		    fmt.vprintf(va_list.copy(l)));
	}

	public static void
	debug(string fmt, ...)
	{
		var l = va_list();
		if ((xhp.arg != null) && xhp.arg.debug)
			Log.all(Color.CYAN, stderr, "DEBUG",
			    fmt.vprintf(va_list.copy(l)));
	}

	public static void
	error(string fmt, ...)
	{
		var l = va_list();
		Log.all(Color.RED, stderr, "ERROR",
		    fmt.vprintf(va_list.copy(l)));
	}

	public static void
	plain(FileStream *target, string fmt, ...)
	{
		var l = va_list();
		target->vprintf(fmt, va_list.copy(l));
	}

	public static void
	custom(string name, Color color, string fmt, ...)
	{
		var l = va_list();
		Log.all(color, stdout, name, fmt.vprintf(va_list.copy(l)));
	}

	public static void
	all(Color color, FileStream *target, string name, string message)
	{
		target->printf("%c[%dm%c[%dm[%s] => %s%c[%dm\n",
		    Color.ESC, Color.BOLD, Color.ESC, color,
		    name, message, Color.ESC, Color.OFF);
{'fraction_non_alphanumeric': 0.1780821917808219, 'fraction_numerical': 0.01487279843444227, 'mean_word_length': 3.3248730964467006, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1297732', 'n_tokens_mistral': 1113, 'n_tokens_neox': 991, 'n_words': 241}