finish log realdata send funtion

This commit is contained in:
lnk
2025-02-27 16:28:04 +08:00
parent f167d705a9
commit c843247d68
7 changed files with 439 additions and 230 deletions

View File

@@ -344,6 +344,7 @@ void my_rocketmq_send(Ckafka_data_t& data)
else
{
topic = data.strTopic.toStdString();
}
if (g_onlyIP[0] != 0)
{
@@ -598,12 +599,17 @@ void KafkaSendThread::run()
bool log_gotten;
log_gotten = false;
if (normalOutputEnabled) {
// <20><><EFBFBD><EFBFBD> normalOutputEnabled Ϊ 1<><31><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD> normalList <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD> normalList <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
pthread_mutex_lock(&normalListMutex);
if (!normalList.empty()) {
data_gotten = true;
//qDebug() << "flag of list:" << normalOutputEnabled << " " << warnOutputEnabled << " " << errorOutputEnabled << " " << "warnList size: " << warnList.size() << "normalList size: " << normalList.size() << "errorList size: " << errorList.size()<<endl;
log_gotten = true;
log_send.strText = QString::fromStdString(normalList.front());
normalList.pop_front();
}
@@ -613,7 +619,7 @@ void KafkaSendThread::run()
// <20><><EFBFBD><EFBFBD> warnList <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
pthread_mutex_lock(&warnListMutex);
if (!warnList.empty()) {
data_gotten = true;
log_gotten = true;
log_send.strText = QString::fromStdString(warnList.front());
warnList.pop_front();
}
@@ -623,7 +629,7 @@ void KafkaSendThread::run()
// <20><><EFBFBD><EFBFBD> errorList <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
pthread_mutex_lock(&errorListMutex);
if (!errorList.empty()) {
data_gotten = true;
log_gotten = true;
log_send.strText = QString::fromStdString(errorList.front());
errorList.pop_front();
}
@@ -631,9 +637,9 @@ void KafkaSendThread::run()
}
if (log_gotten) {
//qDebug() << "send log to topic:" << log_send.strTopic << endl;
static uint32_t count = 0;
printf("BEGIN current log send no.%i -------->>>>>>>>>>>> %s \n", count,
QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz").toAscii().data());
//printf("BEGIN current log send no.%i -------->>>>>>>>>>>> %s \n", count,QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz").toAscii().data());
my_rocketmq_send(log_send);
}
@@ -1520,7 +1526,10 @@ void parse_log(const std::string& json_str) {
redirectNormalOutput(false);
}
else{
std::cout << "level error" <<std::endl;
redirectErrorOutput(false);
redirectWarnOutput(false);
redirectNormalOutput(false);
std::cout << "close all log" <<std::endl;
}
}
}