Project

General

Profile

Info on Using DAQLogger

Developers of lbne-artdaq should not use std::cerr, std::cout, printf, or any other output facility other than those defined in the DAQLogger namespace, found in lbne-artdaq/DAQLogger/DAQLogger.hh. This is because the functions provided in DAQLogger perform a lot of work "under the covers", including sending messages to RunControl. The usage of DAQLogger functions is very similar to std::cout (and even more similar to the functions provided by the messagefacility package). A code snippet containing examples of the four DAQLogger functions (including info on their intended use) is as follows:

DAQLogger::LogError("YourModule") << "This is a run-ending error, which will automatically throw an exception";

DAQLogger::LogWarning("YourModule") << "This is a problem which isn't run-ending";

DAQLogger::LogInfo("YourModule") << "This is useful information for both users and developers, not indicative of anything going wrong";

DAQLogger::LogDebug("YourModule") << "This is standard debug-level information, primarily of developer interest";

In order to use the DAQLogger functions in your code, you'll want to link in the lbne-artdaq_DAQLogger library. This is already done for the ToySimulator fragment generator, and by looking at lbne-artdaq/lbne-artdaq/Generators/CMakeLists.txt on any develop branch commit made on or after May-6-2015, you can see how this is done:

simple_plugin(ToySimulator "generator" 
  ...
  lbne-artdaq_DAQLogger
  )

(where here, I've replaced the other libraries actually provided in the ToySimulator build definition with an ellipse for ease of reading).