Skip to content

Commit

Permalink
Let user define strings in pevent collector (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
furuame authored May 11, 2023
1 parent 62e6f57 commit bd3a6df
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sparta/sparta/pevents/PeventCollector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace pevents{
class PeventCollector
: public PairCollector<CollectedEntityType>, public PeventCollectorTreeNode
{
protected:
using PairCollector<CollectedEntityType>::getPEventLogVector;
using PairCollector<CollectedEntityType>::turnOn_;
using PairCollector<CollectedEntityType>::turnOff_;
Expand Down Expand Up @@ -180,14 +181,14 @@ namespace pevents{
* \brief Override the generateCollectionString_() of the bases PairCollector,
* In this method, we use the pair_cache owned by PairCache.
*/
virtual void generateCollectionString_() override final
virtual void generateCollectionString_() override
{
// Write the pevent to the log.
std::stringstream ss;
// Write the event name.
ss << "ev=" << "\"" << event_name_ << "\" ";

// Now write the chached key values.
// Now write the cached key values.
for(const auto & pair : getPEventLogVector())
{
ss << pair.first << "=" << "\"" << pair.second << "\" ";
Expand All @@ -199,7 +200,7 @@ namespace pevents{
ss << ";";
message_src_ << ss.str();
}
private:

const std::string event_name_;
// We are going to use sparta's logger to output our pevents for ease.
log::MessageSource message_src_;
Expand Down

0 comments on commit bd3a6df

Please sign in to comment.