<commit_before>#ifndef POST_LOG_DISPATCH_HANDLER_TEST_H
#define POST_LOG_DISPATCH_HANDLER_TEST_H

#include "test.h"

static std::vector<el::base::type::string_t> loggedMessages;

void postLogHandler(const LogMessage* msg) {
    loggedMessages.push_back(msg->message());
}

TEST(LogDispatchCallbackTest, Installation) {
    LOG(INFO) << "Log before handler installed";
    EXPECT_TRUE(loggedMessages.empty());
    
    // Install handler
    Helpers::installLogDispatchCallback(postLogHandler, false);
    LOG(INFO) << "Should be part of loggedMessages - 1";
    EXPECT_EQ(1, loggedMessages.size());
    type::string_t expectedMessage = ELPP_LITERAL("Should be part of loggedMessages - 1");
    EXPECT_EQ(expectedMessage, loggedMessages.at(0));
}

TEST(LogDispatchCallbackTest, Uninstallation) {
    
    // Uninstall handler
    Helpers::uninstallLogDispatchCallback(false);
    LOG(INFO) << "This is not in list";
    EXPECT_EQ(loggedMessages.end(), 
        std::find(loggedMessages.begin(), loggedMessages.end(), ELPP_LITERAL("This is not in list")));
}

#endif // POST_LOG_DISPATCH_HANDLER_TEST_H<commit_msg>test fix<commit_after>#ifndef POST_LOG_DISPATCH_HANDLER_TEST_H
#define POST_LOG_DISPATCH_HANDLER_TEST_H

#include "test.h"

static std::vector<el::base::type::string_t> loggedMessages;

class LogHandler : el::LogDispatchCallback {
public:
    void handle(const LogMessage* msg) {
        loggedMessages.push_back(msg->message());
    }
};

TEST(LogDispatchCallbackTest, Installation) {
    LOG(INFO) << "Log before handler installed";
    EXPECT_TRUE(loggedMessages.empty());
    
    // Install handler
    Helpers::installLogDispatchCallback<LogHandler>("LogHandler", false);
    LOG(INFO) << "Should be part of loggedMessages - 1";
    EXPECT_EQ(1, loggedMessages.size());
    type::string_t expectedMessage = ELPP_LITERAL("Should be part of loggedMessages - 1");
    EXPECT_EQ(expectedMessage, loggedMessages.at(0));
}

TEST(LogDispatchCallbackTest, Uninstallation) {
    
    // Uninstall handler
    Helpers::uninstallLogDispatchCallback<LogHandler>("LogHandler", false);
    LOG(INFO) << "This is not in list";
    EXPECT_EQ(loggedMessages.end(), 
        std::find(loggedMessages.begin(), loggedMessages.end(), ELPP_LITERAL("This is not in list")));
}

#endif // POST_LOG_DISPATCH_HANDLER_TEST_H
{'fraction_non_alphanumeric': 0.12354211663066955, 'fraction_numerical': 0.0034557235421166306, 'mean_word_length': 5.2594594594594595, 'pattern_counts': {'":': 0, '<': 19, '<?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': '1197741', 'n_tokens_mistral': 736, 'n_tokens_neox': 737, 'n_words': 137}