Create HIFI_FCDEBUG(_ID) variants that require a category

Original macros use default settings.
This commit is contained in:
Simon Walton 2018-04-04 09:49:15 -07:00
parent 7d16ca9c1c
commit 692ccfc09b
22 changed files with 47 additions and 43 deletions

View file

@ -611,13 +611,13 @@ bool DomainServer::isPacketVerified(const udt::Packet& packet) {
// let the NodeList do its checks now (but pass it the sourceNode so it doesn't need to look it up again)
return nodeList->isPacketVerifiedWithSource(packet, sourceNode.data());
} else {
HIFI_FDEBUG((*QLoggingCategory::defaultCategory()), "Packet of type" << headerType
HIFI_FDEBUG("Packet of type" << headerType
<< "received from unmatched IP for UUID" << uuidStringWithoutCurlyBraces(sourceID));
return false;
}
} else {
HIFI_FDEBUG((*QLoggingCategory::defaultCategory()), "Packet of type" << headerType
HIFI_FDEBUG("Packet of type" << headerType
<< "received from unknown node with UUID" << uuidStringWithoutCurlyBraces(sourceID));
return false;
@ -1268,7 +1268,7 @@ void DomainServer::processRequestAssignmentPacket(QSharedPointer<ReceivedMessage
auto it = find_if(_acSubnetWhitelist.begin(), _acSubnetWhitelist.end(), isHostAddressInSubnet);
if (it == _acSubnetWhitelist.end()) {
HIFI_FDEBUG((*QLoggingCategory::defaultCategory()), "Received an assignment connect request from a disallowed ip address:"
HIFI_FDEBUG("Received an assignment connect request from a disallowed ip address:"
<< senderAddr.toString());
return;
}

View file

@ -6018,7 +6018,7 @@ bool Application::nearbyEntitiesAreReadyForPhysics() {
bool result = true;
foreach (EntityItemPointer entity, entities) {
if (entity->shouldBePhysical() && !entity->isReadyToComputeShape()) {
HIFI_FDEBUG(interfaceapp(), "Physics disabled until entity loads: " << entity->getID() << entity->getName());
HIFI_FCDEBUG(interfaceapp(), "Physics disabled until entity loads: " << entity->getID() << entity->getName());
// don't break here because we want all the relevant entities to start their downloads
result = false;
}

View file

@ -87,7 +87,7 @@ EntityDynamicPointer InterfaceDynamicFactory::factoryBA(EntityItemPointer ownerE
if (dynamic) {
dynamic->deserialize(data);
if (dynamic->lifetimeIsOver()) {
HIFI_FDEBUG((*QLoggingCategory::defaultCategory()), "InterfaceDynamicFactory::factoryBA lifetimeIsOver during dynamic creation --"
HIFI_FDEBUG("InterfaceDynamicFactory::factoryBA lifetimeIsOver during dynamic creation --"
<< dynamic->getExpires() << "<" << usecTimestampNow());
return nullptr;
}

View file

@ -164,7 +164,7 @@ int AudioRingBufferTemplate<T>::writeData(const char* data, int maxSize) {
_nextOutput = shiftedPositionAccomodatingWrap(_nextOutput, samplesToDelete);
_overflowCount++;
HIFI_FDEBUG(audio(), RING_BUFFER_OVERFLOW_DEBUG);
HIFI_FCDEBUG(audio(), RING_BUFFER_OVERFLOW_DEBUG);
qPrintable(RING_BUFFER_OVERFLOW_DEBUG);
}
@ -222,7 +222,7 @@ int AudioRingBufferTemplate<T>::addSilentSamples(int silentSamples) {
if (numWriteSamples > samplesRoomFor) {
numWriteSamples = samplesRoomFor;
HIFI_FDEBUG(audio(), DROPPED_SILENT_DEBUG);
HIFI_FCDEBUG(audio(), DROPPED_SILENT_DEBUG);
}
if (_endOfLastWrite + numWriteSamples > _buffer + _bufferLength) {
@ -273,7 +273,7 @@ int AudioRingBufferTemplate<T>::writeSamples(ConstIterator source, int maxSample
int samplesToDelete = samplesToCopy - samplesRoomFor;
_nextOutput = shiftedPositionAccomodatingWrap(_nextOutput, samplesToDelete);
_overflowCount++;
HIFI_FDEBUG(audio(), RING_BUFFER_OVERFLOW_DEBUG);
HIFI_FCDEBUG(audio(), RING_BUFFER_OVERFLOW_DEBUG);
}
Sample* bufferLast = _buffer + _bufferLength - 1;
@ -295,7 +295,7 @@ int AudioRingBufferTemplate<T>::writeSamplesWithFade(ConstIterator source, int m
int samplesToDelete = samplesToCopy - samplesRoomFor;
_nextOutput = shiftedPositionAccomodatingWrap(_nextOutput, samplesToDelete);
_overflowCount++;
HIFI_FDEBUG(audio(), RING_BUFFER_OVERFLOW_DEBUG);
HIFI_FCDEBUG(audio(), RING_BUFFER_OVERFLOW_DEBUG);
}
Sample* bufferLast = _buffer + _bufferLength - 1;

View file

@ -81,7 +81,7 @@ int PositionalAudioStream::parsePositionalData(const QByteArray& positionalByteA
// if the client sends us a bad position, flag it so that we don't consider this stream for mixing
if (glm::isnan(_position.x) || glm::isnan(_position.y) || glm::isnan(_position.z)) {
HIFI_FDEBUG((*QLoggingCategory::defaultCategory()), "PositionalAudioStream unpacked invalid position for node" << uuidStringWithoutCurlyBraces(getNodeID()) );
HIFI_FDEBUG("PositionalAudioStream unpacked invalid position for node" << uuidStringWithoutCurlyBraces(getNodeID()) );
_hasValidPosition = false;
} else {

View file

@ -2197,7 +2197,7 @@ void EntityItem::deserializeActionsInternal() {
entity->addActionInternal(simulation, action);
updated << actionID;
} else {
HIFI_FDEBUG(entities(), "EntityItem::deserializeActionsInternal -- action creation failed for"
HIFI_FCDEBUG(entities(), "EntityItem::deserializeActionsInternal -- action creation failed for"
<< getID() << _name); // getName();
removeActionInternal(actionID, nullptr);
}

View file

@ -1630,7 +1630,7 @@ int EntityTree::processEditPacketData(ReceivedMessage& message, const unsigned c
_recentlyDeletedEntityItemIDs.insert(usecTimestampNow(), entityItemID);
}
} else {
HIFI_FDEBUG(entities(), "Edit failed. [" << message.getType() <<"] " <<
HIFI_FCDEBUG(entities(), "Edit failed. [" << message.getType() <<"] " <<
"entity id:" << entityItemID <<
"existingEntity pointer:" << existingEntity.get());
}

View file

@ -572,12 +572,12 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) {
}
if (!totalSourceIndices) {
HIFI_FDEBUG(modelformat(), "buildModelMesh failed -- no indices, url = " << url);
HIFI_FCDEBUG(modelformat(), "buildModelMesh failed -- no indices, url = " << url);
return;
}
if (extractedMesh.vertices.size() == 0) {
HIFI_FDEBUG(modelformat(), "buildModelMesh failed -- no vertices, url = " << url);
HIFI_FCDEBUG(modelformat(), "buildModelMesh failed -- no vertices, url = " << url);
return;
}

View file

@ -277,7 +277,7 @@ bool LimitedNodeList::packetSourceAndHashMatchAndTrackBandwidth(const udt::Packe
emit dataReceived(sendingNodeType, packet.getPayloadSize());
return true;
} else {
HIFI_FDEBUG(networking(), "Replicated packet of type" << headerType
HIFI_FCDEBUG(networking(), "Replicated packet of type" << headerType
<< "received from unknown upstream" << packet.getSenderSockAddr());
return false;
@ -340,7 +340,7 @@ bool LimitedNodeList::packetSourceAndHashMatchAndTrackBandwidth(const udt::Packe
return true;
} else {
HIFI_FDEBUG(networking(),
HIFI_FCDEBUG(networking(),
"Packet of type" << headerType << "received from unknown node with UUID" << uuidStringWithoutCurlyBraces(sourceID));
}
}

View file

@ -89,7 +89,7 @@ SequenceNumberStats::ArrivalInfo SequenceNumberStats::sequenceNumberReceived(qui
} else if (absGap > MAX_REASONABLE_SEQUENCE_GAP) {
arrivalInfo._status = Unreasonable;
HIFI_FDEBUG(networking(), "unreasonable sequence number:" << incoming << "previous:" << _lastReceivedSequence);
HIFI_FCDEBUG(networking(), "unreasonable sequence number:" << incoming << "previous:" << _lastReceivedSequence);
_stats._unreasonable++;
@ -151,7 +151,7 @@ SequenceNumberStats::ArrivalInfo SequenceNumberStats::sequenceNumberReceived(qui
arrivalInfo._status = Unreasonable;
HIFI_FDEBUG(networking(), "unreasonable sequence number:" << incoming << "(possible duplicate)");
HIFI_FCDEBUG(networking(), "unreasonable sequence number:" << incoming << "(possible duplicate)");
_stats._unreasonable++;

View file

@ -107,7 +107,7 @@ Packet::Packet(std::unique_ptr<char[]> data, qint64 size, const HifiSockAddr& se
QString::number(getMessagePartNumber()));
}
HIFI_FDEBUG(networking(), debugString);
HIFI_FCDEBUG(networking(), debugString);
#endif
obfuscate(NoObfuscation); // Undo obfuscation

View file

@ -479,7 +479,7 @@ bool SendQueue::maybeResendPacket() {
debugString = debugString.arg(QString::number(resendPacket.getMessageNumber()),
QString::number(resendPacket.getMessagePartNumber()));
}
HIFI_FDEBUG((*QLoggingCategory::defaultCategory()), debugString);
HIFI_FDEBUG(debugString);
#endif
// Create copy of the packet

View file

@ -229,7 +229,7 @@ qint64 Socket::writeDatagram(const QByteArray& datagram, const HifiSockAddr& soc
if (bytesWritten < 0) {
// when saturating a link this isn't an uncommon message - suppress it so it doesn't bomb the debug
HIFI_FDEBUG(networking(), "Socket::writeDatagram" << _udpSocket.error() << "-" << qPrintable(_udpSocket.errorString()) );
HIFI_FCDEBUG(networking(), "Socket::writeDatagram" << _udpSocket.error() << "-" << qPrintable(_udpSocket.errorString()) );
}
return bytesWritten;
@ -513,7 +513,7 @@ std::vector<HifiSockAddr> Socket::getConnectionSockAddrs() {
}
void Socket::handleSocketError(QAbstractSocket::SocketError socketError) {
HIFI_FDEBUG(networking(), "udt::Socket error - " << socketError << _udpSocket.errorString());
HIFI_FCDEBUG(networking(), "udt::Socket error - " << socketError << _udpSocket.errorString());
}
void Socket::handleStateChanged(QAbstractSocket::SocketState socketState) {

View file

@ -121,7 +121,7 @@ void Octree::recurseTreeWithPostOperation(const RecurseOctreeOperation& operatio
void Octree::recurseElementWithOperation(const OctreeElementPointer& element, const RecurseOctreeOperation& operation, void* extraData,
int recursionCount) {
if (recursionCount > DANGEROUSLY_DEEP_RECURSION) {
HIFI_FDEBUG(octree(), "Octree::recurseElementWithOperation() reached DANGEROUSLY_DEEP_RECURSION, bailing!");
HIFI_FCDEBUG(octree(), "Octree::recurseElementWithOperation() reached DANGEROUSLY_DEEP_RECURSION, bailing!");
return;
}
@ -139,7 +139,7 @@ void Octree::recurseElementWithOperation(const OctreeElementPointer& element, co
void Octree::recurseElementWithPostOperation(const OctreeElementPointer& element, const RecurseOctreeOperation& operation,
void* extraData, int recursionCount) {
if (recursionCount > DANGEROUSLY_DEEP_RECURSION) {
HIFI_FDEBUG(octree(), "Octree::recurseElementWithPostOperation() reached DANGEROUSLY_DEEP_RECURSION, bailing!");
HIFI_FCDEBUG(octree(), "Octree::recurseElementWithPostOperation() reached DANGEROUSLY_DEEP_RECURSION, bailing!");
return;
}
@ -165,7 +165,7 @@ void Octree::recurseElementWithOperationDistanceSorted(const OctreeElementPointe
const glm::vec3& point, void* extraData, int recursionCount) {
if (recursionCount > DANGEROUSLY_DEEP_RECURSION) {
HIFI_FDEBUG(octree(), "Octree::recurseElementWithOperationDistanceSorted() reached DANGEROUSLY_DEEP_RECURSION, bailing!");
HIFI_FCDEBUG(octree(), "Octree::recurseElementWithOperationDistanceSorted() reached DANGEROUSLY_DEEP_RECURSION, bailing!");
return;
}
@ -203,7 +203,7 @@ void Octree::recurseTreeWithOperator(RecurseOctreeOperator* operatorObject) {
bool Octree::recurseElementWithOperator(const OctreeElementPointer& element,
RecurseOctreeOperator* operatorObject, int recursionCount) {
if (recursionCount > DANGEROUSLY_DEEP_RECURSION) {
HIFI_FDEBUG(octree(), "Octree::recurseElementWithOperator() reached DANGEROUSLY_DEEP_RECURSION, bailing!");
HIFI_FCDEBUG(octree(), "Octree::recurseElementWithOperator() reached DANGEROUSLY_DEEP_RECURSION, bailing!");
return false;
}
@ -269,7 +269,7 @@ OctreeElementPointer Octree::createMissingElement(const OctreeElementPointer& la
const unsigned char* codeToReach, int recursionCount) {
if (recursionCount > DANGEROUSLY_DEEP_RECURSION) {
HIFI_FDEBUG(octree(), "Octree::createMissingElement() reached DANGEROUSLY_DEEP_RECURSION, bailing!");
HIFI_FCDEBUG(octree(), "Octree::createMissingElement() reached DANGEROUSLY_DEEP_RECURSION, bailing!");
return lastParentElement;
}
int indexOfNewChild = branchIndexWithDescendant(lastParentElement->getOctalCode(), codeToReach);
@ -426,7 +426,7 @@ void Octree::readBitstreamToTree(const unsigned char * bitstream, uint64_t buffe
(unsigned char *)bitstreamAt, NULL);
int numberOfThreeBitSectionsInStream = numberOfThreeBitSectionsInCode(bitstreamAt, bufferSizeBytes);
if (numberOfThreeBitSectionsInStream > UNREASONABLY_DEEP_RECURSION) {
HIFI_FDEBUG(octree(), "UNEXPECTED: parsing of the octal code would make UNREASONABLY_DEEP_RECURSION... "
HIFI_FCDEBUG(octree(), "UNEXPECTED: parsing of the octal code would make UNREASONABLY_DEEP_RECURSION... "
"numberOfThreeBitSectionsInStream:" << numberOfThreeBitSectionsInStream <<
"This buffer is corrupt. Returning.");
return;

View file

@ -401,7 +401,7 @@ OctreeElementPointer OctreeElement::addChildAtIndex(int childIndex) {
bool OctreeElement::safeDeepDeleteChildAtIndex(int childIndex, int recursionCount) {
bool deleteApproved = false;
if (recursionCount > DANGEROUSLY_DEEP_RECURSION) {
HIFI_FDEBUG(octree(), "OctreeElement::safeDeepDeleteChildAtIndex() reached DANGEROUSLY_DEEP_RECURSION, bailing!");
HIFI_FCDEBUG(octree(), "OctreeElement::safeDeepDeleteChildAtIndex() reached DANGEROUSLY_DEEP_RECURSION, bailing!");
return deleteApproved;
}
OctreeElementPointer childToDelete = getChildAtIndex(childIndex);

View file

@ -636,7 +636,7 @@ void OctreeSceneStats::trackIncomingOctreePacket(ReceivedMessage& message, bool
const qint64 MAX_RESONABLE_FLIGHT_TIME = 200 * USECS_PER_SECOND; // 200 seconds is more than enough time for a packet to arrive
const qint64 MIN_RESONABLE_FLIGHT_TIME = -1 * (qint64)USECS_PER_SECOND; // more than 1 second of "reverse flight time" would be unreasonable
if (flightTime > MAX_RESONABLE_FLIGHT_TIME || flightTime < MIN_RESONABLE_FLIGHT_TIME) {
HIFI_FDEBUG(octree(), "ignoring unreasonable packet... flightTime:" << flightTime
HIFI_FCDEBUG(octree(), "ignoring unreasonable packet... flightTime:" << flightTime
<< "nodeClockSkewUsec:" << nodeClockSkewUsec << "usecs");
return; // ignore any packets that are unreasonable
}

View file

@ -87,7 +87,7 @@ btTypedConstraint* ObjectConstraintBallSocket::getConstraint() {
btRigidBody* rigidBodyA = getRigidBody();
if (!rigidBodyA) {
HIFI_FDEBUG(physics(), "ObjectConstraintBallSocket::getConstraint -- no rigidBodyA");
HIFI_FCDEBUG(physics(), "ObjectConstraintBallSocket::getConstraint -- no rigidBodyA");
return nullptr;
}
@ -96,7 +96,7 @@ btTypedConstraint* ObjectConstraintBallSocket::getConstraint() {
btRigidBody* rigidBodyB = getOtherRigidBody(otherEntityID);
if (!rigidBodyB) {
HIFI_FDEBUG(physics(), "ObjectConstraintBallSocket::getConstraint -- no rigidBodyB");
HIFI_FCDEBUG(physics(), "ObjectConstraintBallSocket::getConstraint -- no rigidBodyB");
return nullptr;
}

View file

@ -98,7 +98,7 @@ btTypedConstraint* ObjectConstraintConeTwist::getConstraint() {
btRigidBody* rigidBodyA = getRigidBody();
if (!rigidBodyA) {
HIFI_FDEBUG(physics(), "ObjectConstraintConeTwist::getConstraint -- no rigidBodyA");
HIFI_FCDEBUG(physics(), "ObjectConstraintConeTwist::getConstraint -- no rigidBodyA");
return nullptr;
}
@ -127,7 +127,7 @@ btTypedConstraint* ObjectConstraintConeTwist::getConstraint() {
btRigidBody* rigidBodyB = getOtherRigidBody(otherEntityID);
if (!rigidBodyB) {
HIFI_FDEBUG(physics(), "ObjectConstraintConeTwist::getConstraint -- no rigidBodyB");
HIFI_FCDEBUG(physics(), "ObjectConstraintConeTwist::getConstraint -- no rigidBodyB");
return nullptr;
}

View file

@ -97,7 +97,7 @@ btTypedConstraint* ObjectConstraintHinge::getConstraint() {
btRigidBody* rigidBodyA = getRigidBody();
if (!rigidBodyA) {
HIFI_FDEBUG(physics(), "ObjectConstraintHinge::getConstraint -- no rigidBodyA");
HIFI_FCDEBUG(physics(), "ObjectConstraintHinge::getConstraint -- no rigidBodyA");
return nullptr;
}
@ -112,7 +112,7 @@ btTypedConstraint* ObjectConstraintHinge::getConstraint() {
// This hinge is between two entities... find the other rigid body.
btRigidBody* rigidBodyB = getOtherRigidBody(otherEntityID);
if (!rigidBodyB) {
HIFI_FDEBUG(physics(), "ObjectConstraintHinge::getConstraint -- no rigidBodyB");
HIFI_FCDEBUG(physics(), "ObjectConstraintHinge::getConstraint -- no rigidBodyB");
return nullptr;
}

View file

@ -89,7 +89,7 @@ btTypedConstraint* ObjectConstraintSlider::getConstraint() {
btRigidBody* rigidBodyA = getRigidBody();
if (!rigidBodyA) {
HIFI_FDEBUG(physics(), "ObjectConstraintSlider::getConstraint -- no rigidBodyA");
HIFI_FCDEBUG(physics(), "ObjectConstraintSlider::getConstraint -- no rigidBodyA");
return nullptr;
}
@ -118,7 +118,7 @@ btTypedConstraint* ObjectConstraintSlider::getConstraint() {
btRigidBody* rigidBodyB = getOtherRigidBody(otherEntityID);
if (!rigidBodyB) {
HIFI_FDEBUG(physics(), "ObjectConstraintSlider::getConstraint -- no rigidBodyB");
HIFI_FCDEBUG(physics(), "ObjectConstraintSlider::getConstraint -- no rigidBodyB");
return nullptr;
}

View file

@ -55,7 +55,7 @@ void renderShape(RenderArgs* args, const ShapePlumberPointer& shapeContext, cons
} else if (key.hasOwnPipeline()) {
item.render(args);
} else {
HIFI_FDEBUG(renderlogging(), "Item could not be rendered with invalid key" << key);
HIFI_FCDEBUG(renderlogging(), "Item could not be rendered with invalid key" << key);
}
args->_itemShapeKey = 0;
}
@ -106,7 +106,7 @@ void render::renderStateSortShapes(const RenderContextPointer& renderContext,
} else if (key.hasOwnPipeline()) {
ownPipelineBucket.push_back( std::make_tuple(item, key) );
} else {
HIFI_FDEBUG(renderlogging(), "Item could not be rendered with invalid key" << key);
HIFI_FCDEBUG(renderlogging(), "Item could not be rendered with invalid key" << key);
}
}
}

View file

@ -81,7 +81,7 @@ private:
static QMutex _mutex;
};
#define HIFI_FDEBUG(category, message) \
#define HIFI_FCDEBUG(category, message) \
do { \
if (category.isDebugEnabled()) { \
static int repeatedMessageID_ = LogHandler::getInstance().newRepeatedMessageID(); \
@ -93,9 +93,11 @@ private:
} \
} while (false)
#define HIFI_FDEBUG_ID(category, messageID, message) \
#define HIFI_FDEBUG(message) HIFI_FCDEBUG((*QLoggingCategory::defaultCategory()), message)
#define HIFI_FCDEBUG_ID(category, messageID, message) \
do { \
if (category().isDebugEnabled()) { \
if (category.isDebugEnabled()) { \
QString logString_; \
QDebug debugStringReceiver_(&logString_); \
debugStringReceiver_ << message; \
@ -104,4 +106,6 @@ private:
} \
} while (false)
#define HIFI_FDEBUG_ID(message) HIFI_FCDEBUG_ID((*QLoggingCategory::defaultCategory()), message)
#endif // hifi_LogHandler_h