unified logging
This commit is contained in:
@@ -64,7 +64,7 @@ result_t PollRequest::prepare(unsigned char ownMasterAddress)
|
|||||||
istringstream input;
|
istringstream input;
|
||||||
result_t result = m_message->prepareMaster(ownMasterAddress, m_master, input);
|
result_t result = m_message->prepareMaster(ownMasterAddress, m_master, input);
|
||||||
if (result == RESULT_OK)
|
if (result == RESULT_OK)
|
||||||
L.log(bus, event, " poll msg: %s", m_master.getDataStr().c_str());
|
L.log(bus, event, "poll cmd: %s", m_master.getDataStr().c_str());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ result_t ScanRequest::prepare(unsigned char ownMasterAddress, unsigned char dstA
|
|||||||
istringstream input;
|
istringstream input;
|
||||||
result_t result = m_message->prepareMaster(ownMasterAddress, m_master, input, UI_FIELD_SEPARATOR, dstAddress);
|
result_t result = m_message->prepareMaster(ownMasterAddress, m_master, input, UI_FIELD_SEPARATOR, dstAddress);
|
||||||
if (result == RESULT_OK)
|
if (result == RESULT_OK)
|
||||||
L.log(bus, event, " scan msg: %s", m_master.getDataStr().c_str());
|
L.log(bus, event, "scan cmd: %s", m_master.getDataStr().c_str());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,8 +96,10 @@ void ScanRequest::notify(result_t result)
|
|||||||
m_scanResult << hex << setw(2) << setfill('0') << static_cast<unsigned>(m_master[1]) << UI_FIELD_SEPARATOR;
|
m_scanResult << hex << setw(2) << setfill('0') << static_cast<unsigned>(m_master[1]) << UI_FIELD_SEPARATOR;
|
||||||
result = m_message->decode(pt_slaveData, m_slave, m_scanResult); // decode data
|
result = m_message->decode(pt_slaveData, m_slave, m_scanResult); // decode data
|
||||||
}
|
}
|
||||||
if (result != RESULT_OK)
|
if (result == RESULT_OK)
|
||||||
L.log(bus, error, "scan %x failed: %s", m_master[1], getResultCode(result));
|
L.log(bus, event, "scan result: %s", m_scanResult.str().c_str());
|
||||||
|
else
|
||||||
|
L.log(bus, error, "scan %2.2x failed: %s", m_master[1], getResultCode(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -138,6 +140,9 @@ bool ActiveBusRequest::wait(int timeout)
|
|||||||
|
|
||||||
void ActiveBusRequest::notify(result_t result)
|
void ActiveBusRequest::notify(result_t result)
|
||||||
{
|
{
|
||||||
|
if (result == RESULT_OK)
|
||||||
|
L.log(bus, trace, "read res: %s", m_slave.getDataStr().c_str());
|
||||||
|
|
||||||
pthread_mutex_lock(&m_mutex);
|
pthread_mutex_lock(&m_mutex);
|
||||||
|
|
||||||
m_result = result;
|
m_result = result;
|
||||||
@@ -571,7 +576,6 @@ result_t BusHandler::setState(BusState state, result_t result, bool firstRepetit
|
|||||||
if (m_request->m_deleteOnFinish == true) {
|
if (m_request->m_deleteOnFinish == true) {
|
||||||
if (result == RESULT_OK && typeid(*m_request) == typeid(ScanRequest)) {
|
if (result == RESULT_OK && typeid(*m_request) == typeid(ScanRequest)) {
|
||||||
string res = ((ScanRequest*)m_request)->m_scanResult.str();
|
string res = ((ScanRequest*)m_request)->m_scanResult.str();
|
||||||
L.log(bus, debug, " scan result %x: %s", dstAddress, res.c_str());
|
|
||||||
m_scanResults[dstAddress] = res;
|
m_scanResults[dstAddress] = res;
|
||||||
}
|
}
|
||||||
delete m_request;
|
delete m_request;
|
||||||
@@ -607,12 +611,12 @@ void BusHandler::receiveCompleted()
|
|||||||
|
|
||||||
m_seenAddresses[m_command[0]] = true;
|
m_seenAddresses[m_command[0]] = true;
|
||||||
if (dstAddress == BROADCAST)
|
if (dstAddress == BROADCAST)
|
||||||
L.log(upd, trace, "received BC %s", m_command.getDataStr().c_str());
|
L.log(upd, trace, "update BC cmd: %s", m_command.getDataStr().c_str());
|
||||||
else if (master == true) {
|
else if (master == true) {
|
||||||
L.log(upd, trace, "received MM %s", m_command.getDataStr().c_str());
|
L.log(upd, trace, "update MM cmd: %s", m_command.getDataStr().c_str());
|
||||||
m_seenAddresses[dstAddress] = true;
|
m_seenAddresses[dstAddress] = true;
|
||||||
} else {
|
} else {
|
||||||
L.log(upd, trace, "received MS %s / %s", m_command.getDataStr().c_str(), m_response.getDataStr().c_str());
|
L.log(upd, trace, "update MS cmd: %s / %s", m_command.getDataStr().c_str(), m_response.getDataStr().c_str());
|
||||||
m_seenAddresses[dstAddress] = true;
|
m_seenAddresses[dstAddress] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -628,7 +632,7 @@ void BusHandler::receiveCompleted()
|
|||||||
L.log(upd, error, "unable to parse %s %s from %s / %s: %s", clazz.c_str(), name.c_str(), m_command.getDataStr().c_str(), m_response.getDataStr().c_str(), getResultCode(result));
|
L.log(upd, error, "unable to parse %s %s from %s / %s: %s", clazz.c_str(), name.c_str(), m_command.getDataStr().c_str(), m_response.getDataStr().c_str(), getResultCode(result));
|
||||||
else {
|
else {
|
||||||
string data = output.str();
|
string data = output.str();
|
||||||
L.log(upd, event, "%s %s: %s", clazz.c_str(), name.c_str(), data.c_str());
|
L.log(upd, event, "update %s %s: %s", clazz.c_str(), name.c_str(), data.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user