artdaq_mfextensions  v1_06_02
mftest.cc
1 //#define NDEBUG
2 
3 #include <iostream>
4 
5 #include "messagefacility/MessageLogger/MessageLogger.h"
6 
7 using namespace mf;
8 
9 int main()
10 {
11  // Start MessageFacility Service
12  StartMessageFacility(MessageFacilityService::MultiThread, MessageFacilityService::logCS());
13 
14  // Set application name (use process name by default)
15  SetApplicationName("app1");
16 
17  // Set module name and context for the main thread
18  SetModuleName("eh-test");
19  SetContext("eh-test-1");
20 
21  // Issue messages with different severity levels
22  LogError("cat1|cat2") << "This is an ERROR message.";
23  LogWarning("catwarn") << "Followed by a WARNING message.";
24 
25  // Switch context
26  SetContext("eh-test-2");
27 
28  // Logs
29  LogError("catError") << "Error information.";
30  LogWarning("catWarning") << "Warning information.";
31  LogInfo("catInfo") << "Info information.";
32  LogDebug("debug") << "DEBUG information.";
33 
34  //sleep(2);
35 
36  return 0;
37 }