add echo to testshell and modify mqsend
This commit is contained in:
@@ -125,9 +125,9 @@ extern std::string G_MQCONSUMER_KEY_LOG;//key
|
||||
extern std::string G_LOG_TOPIC;//topie
|
||||
extern std::string G_LOG_TAG;//tag
|
||||
extern std::string G_LOG_KEY;//key
|
||||
extern pthread_mutex_t errorListMutex;
|
||||
extern pthread_mutex_t warnListMutex;
|
||||
extern pthread_mutex_t normalListMutex;
|
||||
|
||||
bool showinshellflag =false;
|
||||
|
||||
|
||||
#define APRTIME_8H (28800000000ULL)
|
||||
#define APRTIME_1H (3600000000ULL)
|
||||
@@ -599,42 +599,77 @@ void KafkaSendThread::run()
|
||||
bool log_gotten;
|
||||
log_gotten = false;
|
||||
|
||||
|
||||
|
||||
if (normalOutputEnabled) {
|
||||
// <20><><EFBFBD><EFBFBD> normalOutputEnabled Ϊ 1<><31><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD> normalList <20><>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD> normalList <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
pthread_mutex_lock(&normalListMutex);
|
||||
if (!normalList.empty()) {
|
||||
|
||||
//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();
|
||||
if(!showinshellflag){
|
||||
if (debugOutputEnabled) {
|
||||
// <20><><EFBFBD><EFBFBD> normalOutputEnabled <20><> warnOutputEnabled <20><>Ϊ 0<><30><EFBFBD><EFBFBD> errorOutputEnabled Ϊ 1<><31>ȡ errorList <20><><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD> errorList <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
pthread_mutex_lock(&debugListMutex);
|
||||
if (!debugList.empty()) {
|
||||
log_gotten = true;
|
||||
log_send.strText = QString::fromStdString(errorList.front());
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD>հ<EFBFBD><D5B0>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>
|
||||
if (log_send.strText.trimmed().isEmpty()) {
|
||||
debugList.pop_front(); // ֱ<>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
||||
log_gotten = false; // <20><><EFBFBD><EFBFBD>û<EFBFBD>л<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>־
|
||||
} else {
|
||||
debugList.pop_front(); // ֻ<>зǿհ<C7BF><D5B0>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&errorListMutex);
|
||||
}
|
||||
pthread_mutex_unlock(&normalListMutex);
|
||||
} else if (warnOutputEnabled) {
|
||||
// <20><><EFBFBD><EFBFBD> normalOutputEnabled Ϊ 0<><30><EFBFBD><EFBFBD> warnOutputEnabled Ϊ 1<><31><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD> warnList <20><>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD> warnList <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
pthread_mutex_lock(&warnListMutex);
|
||||
if (!warnList.empty()) {
|
||||
log_gotten = true;
|
||||
log_send.strText = QString::fromStdString(warnList.front());
|
||||
warnList.pop_front();
|
||||
else 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()) {
|
||||
|
||||
//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());
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD>հ<EFBFBD><D5B0>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>
|
||||
if (log_send.strText.trimmed().isEmpty()) {
|
||||
normalList.pop_front(); // ֱ<>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
||||
log_gotten = false; // <20><><EFBFBD><EFBFBD>û<EFBFBD>л<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>־
|
||||
} else {
|
||||
normalList.pop_front(); // ֻ<>зǿհ<C7BF><D5B0>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&normalListMutex);
|
||||
} else if (warnOutputEnabled) {
|
||||
// <20><><EFBFBD><EFBFBD> normalOutputEnabled Ϊ 0<><30><EFBFBD><EFBFBD> warnOutputEnabled Ϊ 1<><31><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD> warnList <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD> warnList <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
pthread_mutex_lock(&warnListMutex);
|
||||
if (!warnList.empty()) {
|
||||
log_gotten = true;
|
||||
log_send.strText = QString::fromStdString(warnList.front());
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD>հ<EFBFBD><D5B0>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>
|
||||
if (log_send.strText.trimmed().isEmpty()) {
|
||||
warnList.pop_front(); // ֱ<>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
||||
log_gotten = false; // <20><><EFBFBD><EFBFBD>û<EFBFBD>л<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>־
|
||||
} else {
|
||||
warnList.pop_front(); // ֻ<>зǿհ<C7BF><D5B0>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&warnListMutex);
|
||||
} else if (errorOutputEnabled) {
|
||||
// <20><><EFBFBD><EFBFBD> normalOutputEnabled <20><> warnOutputEnabled <20><>Ϊ 0<><30><EFBFBD><EFBFBD> errorOutputEnabled Ϊ 1<><31>ȡ errorList <20><><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD> errorList <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
pthread_mutex_lock(&errorListMutex);
|
||||
if (!errorList.empty()) {
|
||||
log_gotten = true;
|
||||
log_send.strText = QString::fromStdString(errorList.front());
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD>հ<EFBFBD><D5B0>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>
|
||||
if (log_send.strText.trimmed().isEmpty()) {
|
||||
errorList.pop_front(); // ֱ<>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
||||
log_gotten = false; // <20><><EFBFBD><EFBFBD>û<EFBFBD>л<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>־
|
||||
} else {
|
||||
errorList.pop_front(); // ֻ<>зǿհ<C7BF><D5B0>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&errorListMutex);
|
||||
}
|
||||
pthread_mutex_unlock(&warnListMutex);
|
||||
} else if (errorOutputEnabled) {
|
||||
// <20><><EFBFBD><EFBFBD> normalOutputEnabled <20><> warnOutputEnabled <20><>Ϊ 0<><30><EFBFBD><EFBFBD> errorOutputEnabled Ϊ 1<><31>ȡ errorList <20><><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD> errorList <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
pthread_mutex_lock(&errorListMutex);
|
||||
if (!errorList.empty()) {
|
||||
log_gotten = true;
|
||||
log_send.strText = QString::fromStdString(errorList.front());
|
||||
errorList.pop_front();
|
||||
}
|
||||
pthread_mutex_unlock(&errorListMutex);
|
||||
}
|
||||
}
|
||||
|
||||
if (log_gotten) {
|
||||
//qDebug() << "send log to topic:" << log_send.strTopic << endl;
|
||||
@@ -1508,6 +1543,10 @@ void parse_log(const std::string& json_str) {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>
|
||||
redirectNormalOutput(true);
|
||||
}
|
||||
else if (level == "DEBUG"){
|
||||
// <20><><EFBFBD><EFBFBD> debug (ֻ<>浽 debugList<73><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ն<EFBFBD>)
|
||||
redirectDebugOutput(true);
|
||||
}
|
||||
else{
|
||||
std::cout << "level error" <<std::endl;
|
||||
}
|
||||
@@ -1525,7 +1564,11 @@ void parse_log(const std::string& json_str) {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>
|
||||
redirectNormalOutput(false);
|
||||
}
|
||||
else if (level == "DEBUG"){
|
||||
redirectDebugOutput(false);
|
||||
}
|
||||
else{
|
||||
redirectDebugOutput(false);
|
||||
redirectErrorOutput(false);
|
||||
redirectWarnOutput(false);
|
||||
redirectNormalOutput(false);
|
||||
|
||||
Reference in New Issue
Block a user