Skip to content

Commit 94636b7

Browse files
author
Petr Matousek
committed
logging
1 parent f47e0bf commit 94636b7

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

src/api/qpid-proton/reactor/handler/TxReceiverHandler.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -241,40 +241,39 @@ int TxReceiverHandler::getBatchSize() const
241241

242242
void TxReceiverHandler::on_session_open(session &s) {
243243
sess = s;
244-
std::cout << " [on_session_open] declare_txn started..." << std::endl;
244+
logger(trace) << "[on_session_open] declare_txn started...";
245245
s.declare_transaction(*this);
246-
std::cout << " [on_session_open] declare_txn ended..." << std::endl;
246+
logger(trace) << "[on_session_open] declare_txn ended...";
247+
logger(debug) << "[on_session_open] transaction batch size: " << batch_size;
247248
}
248249

249250
void TxReceiverHandler::on_transaction_declare_failed(transaction) {}
250251

251252
void TxReceiverHandler::on_transaction_commit_failed(transaction t) {
252-
std::cout << "Transaction Commit Failed" << std::endl;
253+
logger(debug) << "[on_transaction_commit_failed] Transaction Commit Failed";
253254
t.connection().close();
254255
exit(-1);
255256
}
256257

257258
void TxReceiverHandler::on_transaction_declared(transaction t) {
258-
std::cout << "[on_transaction_declared] txn called " << (&t)
259-
<< std::endl;
260-
std::cout << "[on_transaction_declared] txn is_empty " << (t.is_empty())
261-
<< "\t" << tx.is_empty() << std::endl;
259+
logger(trace) << "[on_transaction_declared] txn called " << (&t);
260+
logger(debug) << "[on_transaction_declared] txn is_empty " << (t.is_empty());
262261
// TODO needed?
263262
// recv.add_credit(batch_size);
264263
tx = t;
265264
}
266265

267266
void TxReceiverHandler::on_transaction_aborted(transaction t) {
268267
confirmed += current_batch;
269-
std::cout << "messages aborted" << std::endl;
268+
logger(debug) << "[on_transaction_aborted] messages aborted";
270269
}
271270

272271
void TxReceiverHandler::on_transaction_committed(transaction t) {
273272
confirmed += current_batch;
274273
current_batch = 0;
275-
std::cout<<" [OnTxnCommitted] Committed:"<< confirmed << std::endl;
274+
logger(trace) << "[on_transaction_committed] Committed:"<< confirmed;
276275
if(confirmed == count) {
277-
std::cout << "All messages committed" << std::endl;
276+
logger(info) << "[on_transaction_committed] All messages committed";
278277
t.connection().close();
279278
}
280279
else {
@@ -534,11 +533,11 @@ void TxReceiverHandler::on_message(delivery &d, message &m)
534533
// TODO
535534
tx.accept(d);
536535
current_batch += 1;
537-
std::cout<<"# CURRENT VS SIZE: " << current_batch <<": " << batch_size << std::endl;
536+
logger(debug) << "[on_message] current batch: " << current_batch;
538537
if(current_batch == batch_size) {
539538
//tx = transaction(); // null
540539
// TODO: I think we should do a commit here ! rakhi is not doing
541-
std::cout<<"# COMMIT: " << current_batch <<": " << batch_size << std::endl;
540+
logger(debug) << "[on_message] messages commited: " << current_batch;
542541
tx.commit();
543542
//sess.declare_transaction(*this);
544543
}

src/api/qpid-proton/reactor/handler/TxSenderHandler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,9 @@ void TxSenderHandler::on_sender_close(sender &s) {
354354

355355
void TxSenderHandler::on_session_open(session &s) {
356356
sess = s;
357-
std::cout << " [on_session_open] declare_txn started..." << std::endl;
357+
logger(trace) << "[on_session_open] declare_txn started...";
358358
s.declare_transaction(*this);
359-
std::cout << " [on_session_open] declare_txn ended..." << std::endl;
359+
logger(trace) << "[on_session_open] declare_txn ended...";
360360
}
361361

362362
void TxSenderHandler::on_container_start(container &c)

0 commit comments

Comments
 (0)