artdaq_mfextensions  v1_05_00
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 
12  // Start MessageFacility Service
13  StartMessageFacility( MessageFacilityService::MultiThread
14  , MessageFacilityService::logCS() );
15 
16  // Set application name (use process name by default)
17  SetApplicationName("app1");
18 
19  // Set module name and context for the main thread
20  SetModuleName("eh-test");
21  SetContext("eh-test-1");
22 
23  // Issue messages with different severity levels
24  LogError("cat1|cat2") << "This is an ERROR message.";
25  LogWarning("catwarn") << "Followed by a WARNING message.";
26 
27  // Switch context
28  SetContext("eh-test-2");
29 
30  // Logs
31  LogError("catError") << "Error information.";
32  LogWarning("catWarning") << "Warning information.";
33  LogInfo("catInfo") << "Info information.";
34  LogDebug("debug") << "DEBUG information.";
35 
36  //sleep(2);
37 
38  return 0;
39 }