CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CustomUIsessionThreadPrefix.cc
Go to the documentation of this file.
2 
4  : CustomUIsession(), m_threadPrefix(threadPrefix + std::to_string(threadId) + ">> ") {}
5 
7 
8 namespace {
9  std::string addThreadPrefix(const std::string& threadPrefix, const std::string str) {
10  // Add thread prefix to each line beginning
12  std::string::size_type beg = 0;
13  std::string::size_type end = str.find('\n');
14  while (end != std::string::npos) {
15  ret += threadPrefix + str.substr(beg, end - beg) + "\n";
16  beg = end + 1;
17  end = str.find('\n', beg);
18  }
19  ret += threadPrefix + str.substr(beg, end);
20  return ret;
21  }
22 } // namespace
23 
24 G4int CustomUIsessionThreadPrefix::ReceiveG4cout(const G4String& coutString) {
25  //edm::LogInfo("G4cout") << addThreadPrefix(m_threadPrefix, trim(coutString));
26  edm::LogVerbatim("G4cout") << addThreadPrefix(m_threadPrefix, trim(coutString));
27  return 0;
28 }
29 
30 G4int CustomUIsessionThreadPrefix::ReceiveG4cerr(const G4String& cerrString) {
31  edm::LogWarning("G4cerr") << addThreadPrefix(m_threadPrefix, trim(cerrString));
32  return 0;
33 }
Log< level::Info, true > LogVerbatim
tuple ret
prodAgent to be discontinued
G4int ReceiveG4cout(const G4String &coutString) override
G4int ReceiveG4cerr(const G4String &cerrString) override
uint16_t size_type
std::string trim(const std::string &str)
string end
Definition: dataset.py:937
Log< level::Warning, false > LogWarning
#define str(s)
CustomUIsessionThreadPrefix(const std::string &threadPrefix, int threadId)