<commit_before>/******************************
** Tsunagari Tile Engine     **
** log.cpp                   **
** Copyright 2011 OmegaSDG   **
******************************/

#include "log.h"

// Singleton Enforcement
Log* Log::pInstance = NULL;

// Singleton Enforcement
Log* Log::instance()
{
	if (!pInstance)
		pInstance = new Log;

	return pInstance;
}

// Specify mode setting.
void Log::setMode(message_mode_t mode)
{
	Log* mh = instance();
	mh->mode = mode;
}

// Give output to the "write" function if it is allowed to be sent in the current
// mode.
void Log::err(std::string domain, std::string message)
{
	std::cerr << "Err: " << domain << ": " << message << std::endl;
}

void Log::dev(std::string domain, std::string message)
{
	Log* l = instance();
	if (l->mode == MM_DEBUG || l->mode == MM_DEVELOPER)
		std::cerr << "Dev: " << domain << ": " << message << std::endl;
}

void Log::dbg(std::string domain, std::string message)
{
	Log* l = instance();
	if (l->mode == MM_DEBUG)
		std::cerr << "Dbg: " << domain << ": " << message << std::endl;
}
<commit_msg>Log singleton is static local var<commit_after>/******************************
** Tsunagari Tile Engine     **
** log.cpp                   **
** Copyright 2011 OmegaSDG   **
******************************/

#include "log.h"

// Singleton Enforcement
Log* Log::instance()
{
	static Log* inst = NULL;

	if (!inst)
		inst = new Log;

	return inst;
}

// Specify mode setting.
void Log::setMode(message_mode_t mode)
{
	Log* l = instance();
	l->mode = mode;
}

// Give output to the "write" function if it is allowed to be sent in the current
// mode.
void Log::err(std::string domain, std::string message)
{
	std::cerr << "Err: " << domain << ": " << message << std::endl;
}

void Log::dev(std::string domain, std::string message)
{
	Log* l = instance();
	if (l->mode == MM_DEBUG || l->mode == MM_DEVELOPER)
		std::cerr << "Dev: " << domain << ": " << message << std::endl;
}

void Log::dbg(std::string domain, std::string message)
{
	Log* l = instance();
	if (l->mode == MM_DEBUG)
		std::cerr << "Dbg: " << domain << ": " << message << std::endl;
}

{'fraction_non_alphanumeric': 0.23701605288007555, 'fraction_numerical': 0.003777148253068933, 'mean_word_length': 3.761797752808989, 'pattern_counts': {'":': 6, '<': 63, '<?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': '6831882', 'n_tokens_mistral': 742, 'n_tokens_neox': 704, 'n_words': 200}