Skip to content

Commit

Permalink
feat: switch from JANA2 LOG to spdlog for printed collections
Browse files Browse the repository at this point in the history
  • Loading branch information
wdconinc committed Oct 5, 2023
1 parent f2394d6 commit d0c5b53
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/services/io/podio/JEventProcessorPODIO.cc
Original file line number Diff line number Diff line change
Expand Up @@ -298,28 +298,30 @@ void JEventProcessorPODIO::Process(const std::shared_ptr<const JEvent> &event) {
// Print the contents of some collections, just for debugging purposes
// Do this before writing just in case writing crashes
if (!m_collections_to_print.empty()) {
LOG << "========================================" << LOG_END;
LOG << "JEventProcessorPODIO: Event " << event->GetEventNumber() << LOG_END;
m_log->log(spdlog::level::off, "==================================");
m_log->log(spdlog::level::off, "Event {}", event->GetEventNumber());
}
for (const auto& coll_name : m_collections_to_print) {
LOG << "------------------------------" << LOG_END;
LOG << coll_name << LOG_END;
m_log->log(spdlog::level::off, "------------------------------");
m_log->log(spdlog::level::off, "{}", coll_name);
try {
const auto* coll_ptr = event->GetCollectionBase(coll_name);
if (coll_ptr == nullptr) {
LOG << "missing" << LOG_END;
m_log->log(spdlog::level::off, "missing");
} else {
coll_ptr->print();
std::ostringstream ostr;
coll_ptr->print(ostr);
m_log->log(spdlog::level::off, ostr.str());
}
}
catch(std::exception &e) {
LOG << "missing" << LOG_END;
m_log->log(spdlog::level::off, "missing");
}
}

// Print the event number
m_log->trace("==================================");
m_log->trace("Event #{}", event->GetEventNumber());

m_log->trace("Event {}", event->GetEventNumber());

// Make sure that all factories get called that need to be written into the frame.
// We need to do this for _all_ factories unless we've constrained it by using includes/excludes.
Expand Down

0 comments on commit d0c5b53

Please sign in to comment.