<commit_before>/*********************************************
* Author: <NAME> - <EMAIL>
* Created: 2017-08-02 11:05
* Last modified: 2017-08-02 11:05
* Filename: Logging.h
* Description: 
**********************************************/

#ifndef ABCDL_UTILS_LOGGING_H_
#define ABCDL_UTILS_LOGGING_H_

#include <sstream>

namespace abcdl{
namespace utils{
namespace logging{

//Log Levels
const int INFO = 0;
const int WARNING = 1;
const int ERROR = 2;
const int FATAL = 3;
const int NUM_SEVERITIES = 4;

#define _ABCDL_LOG_INFO \
    ::abcdl::utils::logging::LogMessage(__FILE__, __LINE__, ::abcdl::utils::logging::INFO)

#define _ABCDL_LOG_WARNING \
    ::abcdl::utils::logging::LogMessage(__FILE__, __LINE__, ::abcdl::utils::logging::WARNING)

#define _ABCDL_LOG_ERROR \
    ::abcdl::utils::logging::LogMessage(__FILE__, __LINE__, ::abcdl::utils::logging::ERROR)

#define _ABCDL_LOG_FATAL \
    ::abcdl::utils::logging::LogMessage(__FILE__, __LINE__, ::abcdl::utils::logging::FATAL)

#define ABCDL_LOG(severity) _ABCDL_LOG_##severity
#define LOG(severity) ABCDL_LOG(severity)

#define PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
#define PREDICT_FALSE(x) (__builtin_expect(x, 0))

#define ABCDL_CHECK(condition) \
    if(PREDICT_FALSE(!(condition))) \
        ABCDL_LOG(FATAL) << "Check failed:" #condition " "

#define ABCDL_CHECK_EQ(v1, v2) ABCDL_CHECK((v1) == (v2))
#define ABCDL_CHECK_NE(v1, v2) ABCDL_CHECK((v1) != (v2))
#define ABCDL_CHECK_LE(v1, v2) ABCDL_CHECK((v1) <= (v2))
#define ABCDL_CHECK_LT(v1, v2) ABCDL_CHECK((v1) < (v2))
#define ABCDL_CHECK_GE(v1, v2) ABCDL_CHECK((v1) >= (v2))
#define ABCDL_CHECK_GT(v1, v2) ABCDL_CHECK((v1) > (v2))
#define ABCDL_CHECK_NOTNULL(v) ABCDL_CHECK((v) != NULL)

void initialize_logging(int argc, char** argv);

void set_min_log_level(int level);

void install_failure_function(void (*callback)());
<commit_msg>initialized<commit_after>/*********************************************
* Author: <NAME> - <EMAIL>
* Created: 2017-08-02 11:05
* Last modified: 2017-08-02 11:05
* Filename: Logging.h
* Description: 
**********************************************/

#ifndef ABCDL_UTILS_LOGGING_H_
#define ABCDL_UTILS_LOGGING_H_

#include <sstream>

namespace abcdl{
namespace utils{
namespace logging{

//Log Levels
const int INFO = 0;
const int WARNING = 1;
const int ERROR = 2;
const int FATAL = 3;
const int NUM_SEVERITIES = 4;

#define _ABCDL_LOG_INFO \
    LogMessage(__FILE__, __LINE__, abcdl::utils::logging::INFO)

#define _ABCDL_LOG_WARNING \
    LogMessage(__FILE__, __LINE__, abcdl::utils::logging::WARNING)

#define _ABCDL_LOG_ERROR \
    LogMessage(__FILE__, __LINE__, abcdl::utils::logging::ERROR)

#define _ABCDL_LOG_FATAL \
    LogMessage(__FILE__, __LINE__, abcdl::utils::logging::FATAL)

#define ABCDL_LOG(severity) _ABCDL_LOG_##severity
#define LOG(severity) ABCDL_LOG(severity)

#define PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
#define PREDICT_FALSE(x) (__builtin_expect(x, 0))

#define ABCDL_CHECK(condition) \
    if(PREDICT_FALSE(!(condition))) \
        ABCDL_LOG(FATAL) << "Check failed:" #condition " "

#define ABCDL_CHECK_EQ(v1, v2) ABCDL_CHECK((v1) == (v2))
#define ABCDL_CHECK_NE(v1, v2) ABCDL_CHECK((v1) != (v2))
#define ABCDL_CHECK_LE(v1, v2) ABCDL_CHECK((v1) <= (v2))
#define ABCDL_CHECK_LT(v1, v2) ABCDL_CHECK((v1) < (v2))
#define ABCDL_CHECK_GE(v1, v2) ABCDL_CHECK((v1) >= (v2))
#define ABCDL_CHECK_GT(v1, v2) ABCDL_CHECK((v1) > (v2))
#define ABCDL_CHECK_NOTNULL(v) ABCDL_CHECK((v) != NULL)

void initialize_logging(int argc, char** argv);

void set_min_log_level(int level);

void install_failure_function(void (*callback)());

{'fraction_non_alphanumeric': 0.19623059866962306, 'fraction_numerical': 0.03048780487804878, 'mean_word_length': 7.110112359550562, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 13, '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': '885837', 'n_tokens_mistral': 1459, 'n_tokens_neox': 1435, 'n_words': 268}