-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from DUNE-DAQ/ron/issue_26_TLOG_issue_bug
Ron/issue 26 tlog issue bug
- Loading branch information
Showing
6 changed files
with
75 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#ifndef DUNEDAQ_PACKAGE_NAME // this could/may be (tbd) set by the build system | ||
# define DUNEDAQ_PACKAGE_NAME "Logging_" // becomes an ERS Qualifier | ||
#endif | ||
#include <logging/Logging.hpp> // NOTE: if ISSUES ARE DECLARED BEFORE include logging/Logging.hpp, TLOG_DEBUG<<issue wont work. | ||
#include <ers/Issue.hpp> | ||
#include <vector> | ||
|
||
ERS_DECLARE_ISSUE(appfwk, ///< Namespace | ||
GeneralDAQModuleIssue, ///< Issue class name | ||
" DAQModule: " << name, ///< Message | ||
((std::string)name) ///< Message parameters | ||
) | ||
|
||
ERS_DECLARE_ISSUE_BASE(logging, | ||
ProgressUpdate, | ||
appfwk::GeneralDAQModuleIssue, | ||
message, | ||
((std::string)name), | ||
((std::string)message)) | ||
|
||
using namespace logging; | ||
|
||
std::ostream& | ||
operator<<(std::ostream& t, std::vector<int> ints) | ||
{ | ||
t << "{"; | ||
bool first = true; | ||
for (auto& i : ints) { | ||
if (!first) | ||
t << ", "; | ||
first = false; | ||
t << i; | ||
} | ||
return t << "}"; | ||
} | ||
|
||
int main(/*int argc, char *argv[]*/) | ||
{ | ||
setenv("DUNEDAQ_APPLICATION_NAME","LOGGING_PROGRESS_APP",0); | ||
dunedaq::logging::Logging::setup(); // not strictly needed -- checks/establishes a default env. | ||
|
||
std::atomic<uint64_t> m_generated_tot{ 7 }; | ||
std::vector<int> theList{1,2,3}; | ||
std::ostringstream oss_prog; | ||
TLOG() << "start"; | ||
oss_prog << "Generated list #" << m_generated_tot.load() << " with contents " << theList | ||
<< " and size " << theList.size() << ". "; | ||
|
||
std::cout << typeid(ProgressUpdate).name() << "\n\n"; | ||
|
||
TLOG() << static_cast<logging::ProgressUpdate>(ProgressUpdate(ERS_HERE, "someName1", oss_prog.str())); | ||
|
||
#if 1 | ||
TLOG_DEBUG() << ProgressUpdate(ERS_HERE, "someName2", oss_prog.str()); | ||
std::cout << ProgressUpdate(ERS_HERE, "someName3", oss_prog.str()) << '\n'; | ||
|
||
TLOG_DEBUG() << ProgressUpdate(ERS_HERE, "someName4", oss_prog.str()); | ||
TLOG_DEBUG() << ProgressUpdate(ERS_HERE, "someName5", oss_prog.str()); | ||
#endif | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters