added qAmqpDebug to reduce debug messages during testing

This commit is contained in:
Matt Broadstone 2014-06-06 13:46:08 -04:00
parent 8599cec147
commit bea9204824
6 changed files with 66 additions and 64 deletions

View File

@ -58,7 +58,7 @@ bool ChannelPrivate::_q_method(const Frame::Method &frame)
if (frame.methodClass() != Frame::fcChannel)
return false;
qDebug("Channel#%d:", channelNumber);
qAmqpDebug("Channel#%d:", channelNumber);
switch (frame.id()) {
case miOpenOk:
@ -100,7 +100,7 @@ void ChannelPrivate::open()
if (!client->isConnected())
return;
qDebug("Open channel #%d", channelNumber);
qAmqpDebug("Open channel #%d", channelNumber);
Frame::Method frame(Frame::fcChannel, miOpen);
frame.setChannel(channelNumber);
@ -119,18 +119,18 @@ void ChannelPrivate::flow()
void ChannelPrivate::flow(const Frame::Method &frame)
{
Q_UNUSED(frame);
qDebug() << Q_FUNC_INFO;
qAmqpDebug() << Q_FUNC_INFO;
}
void ChannelPrivate::flowOk()
{
qDebug() << Q_FUNC_INFO;
qAmqpDebug() << Q_FUNC_INFO;
}
void ChannelPrivate::flowOk(const Frame::Method &frame)
{
Q_UNUSED(frame);
qDebug() << Q_FUNC_INFO;
qAmqpDebug() << Q_FUNC_INFO;
}
void ChannelPrivate::close(int code, const QString &text, int classId, int methodId)
@ -153,7 +153,7 @@ void ChannelPrivate::close(int code, const QString &text, int classId, int metho
void ChannelPrivate::close(const Frame::Method &frame)
{
Q_Q(Channel);
qDebug(">> CLOSE");
qAmqpDebug(">> CLOSE");
stateChanged(csClosed);
QByteArray data = frame.arguments();
QDataStream stream(&data, QIODevice::ReadOnly);
@ -170,10 +170,10 @@ void ChannelPrivate::close(const Frame::Method &frame)
Q_EMIT q->error(error);
}
qDebug(">> code: %d", code);
qDebug(">> text: %s", qPrintable(text));
qDebug(">> class-id: %d", classId);
qDebug(">> method-id: %d", methodId);
qAmqpDebug(">> code: %d", code);
qAmqpDebug(">> text: %s", qPrintable(text));
qAmqpDebug(">> class-id: %d", classId);
qAmqpDebug(">> method-id: %d", methodId);
}
void ChannelPrivate::closeOk()
@ -197,7 +197,7 @@ void ChannelPrivate::openOk(const Frame::Method &frame)
Q_UNUSED(frame)
Q_Q(Channel);
qDebug(">> OpenOK");
qAmqpDebug(">> OpenOK");
opened = true;
stateChanged(csOpened);
q->channelOpened();
@ -207,7 +207,7 @@ void ChannelPrivate::setQOS(qint32 prefetchSize, quint16 prefetchCount)
{
Q_UNUSED(prefetchSize)
Q_UNUSED(prefetchCount)
qDebug() << Q_FUNC_INFO << "temporarily disabled";
qAmqpDebug() << Q_FUNC_INFO << "temporarily disabled";
// client_->d_func()->connection_->d_func()->setQOS(prefetchSize, prefetchCount, channelNumber, false);
}

View File

@ -61,7 +61,7 @@ void ClientPrivate::parseConnectionString(const QUrl &connectionString)
Q_Q(Client);
if (connectionString.scheme() != AMQPSCHEME &&
connectionString.scheme() != AMQPSSCHEME) {
qDebug() << Q_FUNC_INFO << "invalid scheme: " << connectionString.scheme();
qAmqpDebug() << Q_FUNC_INFO << "invalid scheme: " << connectionString.scheme();
return;
}
@ -75,7 +75,7 @@ void ClientPrivate::parseConnectionString(const QUrl &connectionString)
void ClientPrivate::_q_connect()
{
if (socket->state() != QAbstractSocket::UnconnectedState) {
qDebug() << Q_FUNC_INFO << "socket already connected, disconnecting..";
qAmqpDebug() << Q_FUNC_INFO << "socket already connected, disconnecting..";
_q_disconnect();
}
@ -85,7 +85,7 @@ void ClientPrivate::_q_connect()
void ClientPrivate::_q_disconnect()
{
if (socket->state() == QAbstractSocket::UnconnectedState) {
qDebug() << Q_FUNC_INFO << "already disconnected";
qAmqpDebug() << Q_FUNC_INFO << "already disconnected";
return;
}
@ -180,10 +180,10 @@ void ClientPrivate::_q_readyRead()
}
break;
case Frame::ftHeartbeat:
qDebug("AMQP: Heartbeat");
qAmqpDebug("AMQP: Heartbeat");
break;
default:
qWarning() << "AMQP: Unknown frame type: " << type;
qAmqpDebug() << "AMQP: Unknown frame type: " << type;
}
} else {
break;
@ -194,7 +194,7 @@ void ClientPrivate::_q_readyRead()
void ClientPrivate::sendFrame(const Frame::Base &frame)
{
if (socket->state() != QAbstractSocket::ConnectedState) {
qDebug() << Q_FUNC_INFO << "socket not connected: " << socket->state();
qAmqpDebug() << Q_FUNC_INFO << "socket not connected: " << socket->state();
return;
}
@ -208,7 +208,7 @@ bool ClientPrivate::_q_method(const Frame::Method &frame)
if (frame.methodClass() != Frame::fcConnection)
return false;
qDebug() << "Connection:";
qAmqpDebug() << "Connection:";
if (closed) {
if (frame.id() == ClientPrivate::miCloseOk)
closeOk(frame);
@ -243,7 +243,7 @@ bool ClientPrivate::_q_method(const Frame::Method &frame)
void ClientPrivate::start(const Frame::Method &frame)
{
qDebug(">> Start");
qAmqpDebug(">> Start");
QByteArray data = frame.arguments();
QDataStream stream(&data, QIODevice::ReadOnly);
quint8 version_major = 0;
@ -257,13 +257,13 @@ void ClientPrivate::start(const Frame::Method &frame)
QString mechanisms = Frame::readField('S', stream).toString();
QString locales = Frame::readField('S', stream).toString();
qDebug(">> version_major: %d", version_major);
qDebug(">> version_minor: %d", version_minor);
qAmqpDebug(">> version_major: %d", version_major);
qAmqpDebug(">> version_minor: %d", version_minor);
Frame::print(table);
qDebug(">> mechanisms: %s", qPrintable(mechanisms));
qDebug(">> locales: %s", qPrintable(locales));
qAmqpDebug(">> mechanisms: %s", qPrintable(mechanisms));
qAmqpDebug(">> locales: %s", qPrintable(locales));
startOk();
}
@ -271,12 +271,12 @@ void ClientPrivate::start(const Frame::Method &frame)
void ClientPrivate::secure(const Frame::Method &frame)
{
Q_UNUSED(frame)
qDebug() << Q_FUNC_INFO << "called!";
qAmqpDebug() << Q_FUNC_INFO << "called!";
}
void ClientPrivate::tune(const Frame::Method &frame)
{
qDebug(">> Tune");
qAmqpDebug(">> Tune");
QByteArray data = frame.arguments();
QDataStream stream(&data, QIODevice::ReadOnly);
@ -288,9 +288,9 @@ void ClientPrivate::tune(const Frame::Method &frame)
stream >> frame_max;
stream >> heartbeat;
qDebug(">> channel_max: %d", channel_max);
qDebug(">> frame_max: %d", frame_max);
qDebug(">> heartbeat: %d", heartbeat);
qAmqpDebug(">> channel_max: %d", channel_max);
qAmqpDebug(">> frame_max: %d", frame_max);
qAmqpDebug(">> heartbeat: %d", heartbeat);
if (heartbeatTimer) {
heartbeatTimer->setInterval(heartbeat * 1000);
@ -308,7 +308,7 @@ void ClientPrivate::openOk(const Frame::Method &frame)
{
Q_Q(Client);
Q_UNUSED(frame)
qDebug(">> OpenOK");
qAmqpDebug(">> OpenOK");
connected = true;
Q_EMIT q->connected();
}
@ -317,7 +317,7 @@ void ClientPrivate::closeOk(const Frame::Method &frame)
{
Q_Q(Client);
Q_UNUSED(frame)
qDebug() << Q_FUNC_INFO << "received";
qAmqpDebug() << Q_FUNC_INFO << "received";
connected = false;
if (heartbeatTimer)
heartbeatTimer->stop();
@ -327,7 +327,7 @@ void ClientPrivate::closeOk(const Frame::Method &frame)
void ClientPrivate::close(const Frame::Method &frame)
{
Q_Q(Client);
qDebug(">> CLOSE");
qAmqpDebug(">> CLOSE");
QByteArray data = frame.arguments();
QDataStream stream(&data, QIODevice::ReadOnly);
qint16 code = 0, classId, methodId;
@ -343,10 +343,10 @@ void ClientPrivate::close(const Frame::Method &frame)
Q_EMIT q->error(error);
}
qDebug(">> code: %d", code);
qDebug(">> text: %s", qPrintable(text));
qDebug(">> class-id: %d", classId);
qDebug(">> method-id: %d", methodId);
qAmqpDebug(">> code: %d", code);
qAmqpDebug(">> text: %s", qPrintable(text));
qAmqpDebug(">> class-id: %d", classId);
qAmqpDebug(">> method-id: %d", methodId);
connected = false;
Q_EMIT q->disconnected();
}
@ -373,7 +373,7 @@ void ClientPrivate::startOk()
void ClientPrivate::secureOk()
{
qDebug() << Q_FUNC_INFO;
qAmqpDebug() << Q_FUNC_INFO;
}
void ClientPrivate::tuneOk()
@ -672,7 +672,7 @@ void SslClientPrivate::initSocket()
void SslClientPrivate::_q_connect()
{
if (socket->state() != QAbstractSocket::UnconnectedState) {
qDebug() << Q_FUNC_INFO << "socket already connected, disconnecting..";
qAmqpDebug() << Q_FUNC_INFO << "socket already connected, disconnecting..";
_q_disconnect();
}

View File

@ -36,7 +36,7 @@ void ExchangePrivate::declare()
}
if (name.isEmpty()) {
qDebug() << Q_FUNC_INFO << "attempting to declare an unnamed exchange, aborting...";
qAmqpDebug() << Q_FUNC_INFO << "attempting to declare an unnamed exchange, aborting...";
return;
}
@ -85,7 +85,7 @@ void ExchangePrivate::declareOk(const Frame::Method &frame)
Q_UNUSED(frame)
Q_Q(Exchange);
qDebug() << "Declared exchange: " << name;
qAmqpDebug() << "Declared exchange: " << name;
declared = true;
Q_EMIT q->declared();
}
@ -95,7 +95,7 @@ void ExchangePrivate::deleteOk(const Frame::Method &frame)
Q_UNUSED(frame)
Q_Q(Exchange);
qDebug() << "Deleted exchange: " << name;
qAmqpDebug() << "Deleted exchange: " << name;
declared = false;
Q_EMIT q->removed();
}
@ -103,7 +103,7 @@ void ExchangePrivate::deleteOk(const Frame::Method &frame)
void ExchangePrivate::_q_disconnected()
{
ChannelPrivate::_q_disconnected();
qDebug() << "Exchange " << name << " disconnected";
qAmqpDebug() << "Exchange " << name << " disconnected";
delayedDeclare = false;
declared = false;
}

View File

@ -329,13 +329,13 @@ void Frame::print(const TableField &f)
for (it = f.constBegin(); it != itEnd; ++it) {
switch(it.value().type()) {
case QVariant::Hash:
qDebug() << "\t" << qPrintable(it.key()) << ": FIELD_TABLE";
qAmqpDebug() << "\t" << qPrintable(it.key()) << ": FIELD_TABLE";
break;
case QVariant::List:
qDebug() << "\t" << qPrintable(it.key()) << ": ARRAY";
qAmqpDebug() << "\t" << qPrintable(it.key()) << ": ARRAY";
break;
default:
qDebug() << "\t" << qPrintable(it.key()) << ": " << it.value();
qAmqpDebug() << "\t" << qPrintable(it.key()) << ": " << it.value();
}
}
}
@ -482,7 +482,7 @@ void Frame::writeField(QDataStream &s, const QVariant &value)
break;
default:
qDebug() << Q_FUNC_INFO << "unhandled variant type: " << value.type();
qAmqpDebug() << Q_FUNC_INFO << "unhandled variant type: " << value.type();
}
if (type)

View File

@ -24,4 +24,6 @@
# define QAMQP_EXPORT
#endif
#define qAmqpDebug if (qgetenv("QAMQP_DEBUG").isEmpty()); else qDebug
#endif // qamqp_global_h__

View File

@ -117,7 +117,7 @@ void QueuePrivate::_q_body(const Frame::ContentBody &frame)
void QueuePrivate::declareOk(const Frame::Method &frame)
{
Q_Q(Queue);
qDebug() << "Declared queue: " << name;
qAmqpDebug() << "Declared queue: " << name;
declared = true;
QByteArray data = frame.arguments();
@ -126,7 +126,7 @@ void QueuePrivate::declareOk(const Frame::Method &frame)
name = Frame::readField('s', stream).toString();
qint32 messageCount = 0, consumerCount = 0;
stream >> messageCount >> consumerCount;
qDebug("Message count %d\nConsumer count: %d", messageCount, consumerCount);
qAmqpDebug("Message count %d\nConsumer count: %d", messageCount, consumerCount);
Q_EMIT q->declared();
}
@ -134,14 +134,14 @@ void QueuePrivate::declareOk(const Frame::Method &frame)
void QueuePrivate::deleteOk(const Frame::Method &frame)
{
Q_Q(Queue);
qDebug() << "Deleted or purged queue: " << name;
qAmqpDebug() << "Deleted or purged queue: " << name;
declared = false;
QByteArray data = frame.arguments();
QDataStream stream(&data, QIODevice::ReadOnly);
qint32 messageCount = 0;
stream >> messageCount;
qDebug("Message count %d", messageCount);
qAmqpDebug("Message count %d", messageCount);
Q_EMIT q->removed();
}
@ -151,7 +151,7 @@ void QueuePrivate::bindOk(const Frame::Method &frame)
Q_UNUSED(frame)
Q_Q(Queue);
qDebug() << Q_FUNC_INFO << "bound to exchange";
qAmqpDebug() << Q_FUNC_INFO << "bound to exchange";
Q_EMIT q->bound();
}
@ -160,7 +160,7 @@ void QueuePrivate::unbindOk(const Frame::Method &frame)
Q_UNUSED(frame)
Q_Q(Queue);
qDebug() << Q_FUNC_INFO << "unbound exchange";
qAmqpDebug() << Q_FUNC_INFO << "unbound exchange";
Q_EMIT q->unbound();
}
@ -179,21 +179,21 @@ void QueuePrivate::getOk(const Frame::Method &frame)
void QueuePrivate::consumeOk(const Frame::Method &frame)
{
qDebug() << "Consume ok: " << name;
qAmqpDebug() << "Consume ok: " << name;
QByteArray data = frame.arguments();
QDataStream stream(&data, QIODevice::ReadOnly);
consumerTag = Frame::readField('s',stream).toString();
qDebug("Consumer tag = %s", qPrintable(consumerTag));
qAmqpDebug("Consumer tag = %s", qPrintable(consumerTag));
}
void QueuePrivate::deliver(const Frame::Method &frame)
{
qDebug() << Q_FUNC_INFO;
qAmqpDebug() << Q_FUNC_INFO;
QByteArray data = frame.arguments();
QDataStream in(&data, QIODevice::ReadOnly);
QString consumer_ = Frame::readField('s',in).toString();
if (consumer_ != consumerTag) {
qDebug() << Q_FUNC_INFO << "invalid consumer tag: " << consumer_;
qAmqpDebug() << Q_FUNC_INFO << "invalid consumer tag: " << consumer_;
return;
}
@ -208,7 +208,7 @@ void QueuePrivate::deliver(const Frame::Method &frame)
void QueuePrivate::declare()
{
if (name.isEmpty()) {
qDebug() << Q_FUNC_INFO << "can't declare queue with no name";
qAmqpDebug() << Q_FUNC_INFO << "can't declare queue with no name";
return;
}
@ -297,7 +297,7 @@ void Queue::remove(int options)
{
Q_D(Queue);
if (!d->declared) {
qDebug() << Q_FUNC_INFO << "trying to remove undeclared queue, aborting...";
qAmqpDebug() << Q_FUNC_INFO << "trying to remove undeclared queue, aborting...";
return;
}
@ -338,7 +338,7 @@ void Queue::purge()
void Queue::bind(Exchange *exchange, const QString &key)
{
if (!exchange) {
qDebug() << Q_FUNC_INFO << "invalid exchange provided";
qAmqpDebug() << Q_FUNC_INFO << "invalid exchange provided";
return;
}
@ -374,7 +374,7 @@ void Queue::bind(const QString &exchangeName, const QString &key)
void Queue::unbind(Exchange *exchange, const QString &key)
{
if (!exchange) {
qDebug() << Q_FUNC_INFO << "invalid exchange provided";
qAmqpDebug() << Q_FUNC_INFO << "invalid exchange provided";
return;
}
@ -385,7 +385,7 @@ void Queue::unbind(const QString &exchangeName, const QString &key)
{
Q_D(Queue);
if (!d->opened) {
qDebug() << Q_FUNC_INFO << "queue is not open";
qAmqpDebug() << Q_FUNC_INFO << "queue is not open";
return;
}
@ -424,7 +424,7 @@ void Queue::consume(int options)
{
Q_D(Queue);
if (!d->opened) {
qDebug() << Q_FUNC_INFO << "queue is not open";
qAmqpDebug() << Q_FUNC_INFO << "queue is not open";
return;
}
@ -461,7 +461,7 @@ void Queue::get()
{
Q_D(Queue);
if (!d->opened) {
qDebug() << Q_FUNC_INFO << "queue is not open";
qAmqpDebug() << Q_FUNC_INFO << "queue is not open";
return;
}
@ -484,7 +484,7 @@ void Queue::ack(const Message &message)
{
Q_D(Queue);
if (!d->opened) {
qDebug() << Q_FUNC_INFO << "queue is not open";
qAmqpDebug() << Q_FUNC_INFO << "queue is not open";
return;
}