<commit_before>#ifndef NTLOGGER_H
#define NTLOGGER_H
#define LOG_HTTP (unsigned char)1
#define LOG_RACE (unsigned char)2
#define LOG_INFO (unsigned char)3
#define LOG_CONN (unsigned char)4

#include <string>
#include <iostream>
#include <sstream>
#include <fstream>
#include "colors.h"
using namespace std;

class NTLogger {
public:
	NTLogger() {
		closed = false;
		hasFile = false;
	}
	NTLogger(string _fname) {
		fname = _fname;
		stream = ofstream();
		hasFile = true;
		stream.open(_fname);
	}
	void close() {
		if (closed == false && hasFile == true) {
			closed = true;
			stream.close();
		}
	}
	void operator<<(string msg) {
		cout << msg << endl;
		if (hasFile) {
			stream << msg << endl;
		}
	}
	void operator<<(int msgi) {
		cout << msgi;
		if (hasFile) {
			stream << msgi;
		}
	}
	void operator<<(unsigned char type) { // Unsigned char type to allow integers to be written to the stream
		string out;
		string color;
		switch (type) {
			case LOG_HTTP:
				color = CLR_MAG;
				out += "[HTTP] ";
			break;
			case LOG_RACE:
				color = CLR_RED;
				out += "[RACE] ";
			break;
			case LOG_INFO:
				color = CLR_GRN;
				out += "[INFO] ";
				break;
			case LOG_CONN:
				color = CLR_BLU;
				out += "[CONNECT] ";
				break;
			default:
				cout << "Ignoring invalid log type!\n";
				break;
		}
		cout << color << out << CLR_RESET;
		if (hasFile) {
			stream << out;
		}
	}
protected:
	string fname;
	ofstream stream;
	bool closed;
	bool hasFile;
};

#endif<commit_msg>Add type() method<commit_after>#ifndef NTLOGGER_H
#define NTLOGGER_H
#define LOG_HTTP (unsigned char)1
#define LOG_RACE (unsigned char)2
#define LOG_INFO (unsigned char)3
#define LOG_CONN (unsigned char)4

#include <string>
#include <iostream>
#include <sstream>
#include <fstream>
#include "colors.h"
using namespace std;

class NTLogger {
public:
	NTLogger() {
		closed = false;
		hasFile = false;
	}
	NTLogger(string _fname) {
		fname = _fname;
		stream = ofstream();
		hasFile = true;
		stream.open(_fname);
	}
	void close() {
		if (closed == false && hasFile == true) {
			closed = true;
			stream.close();
		}
	}
	void operator<<(string msg) {
		cout << msg << endl;
		if (hasFile) {
			stream << msg << endl;
		}
	}
	void operator<<(int msgi) {
		cout << msgi;
		if (hasFile) {
			stream << msgi;
		}
	}
	void operator<<(unsigned char type) { // Unsigned char type to allow integers to be written to the stream
		writeType(type);
	}
	void type(unsigned char type) {
		writeType(type);
	}
protected:
	string fname;
	ofstream stream;
	bool closed;
	bool hasFile;
	void writeType(unsigned char type) { // Unsigned char type to allow integers to be written to the stream
		string out;
		string color;
		switch (type) {
			case LOG_HTTP:
				color = CLR_MAG;
				out += "[HTTP] ";
			break;
			case LOG_RACE:
				color = CLR_RED;
				out += "[RACE] ";
			break;
			case LOG_INFO:
				color = CLR_GRN;
				out += "[INFO] ";
				break;
			case LOG_CONN:
				color = CLR_BLU;
				out += "[CONNECT] ";
				break;
			default:
				cout << "Ignoring invalid log type!\n";
				break;
		}
		cout << color << out << CLR_RESET;
		if (hasFile) {
			stream << out;
		}
	}
};

#endif
{'fraction_non_alphanumeric': 0.13565768621236132, 'fraction_numerical': 0.0025356576862123614, 'mean_word_length': 3.130890052356021, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 11, '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': '4252394', 'n_tokens_mistral': 1330, 'n_tokens_neox': 1168, 'n_words': 333}