Skip to content

Commit 469d70e

Browse files
committed
update example
1 parent 1fee78d commit 469d70e

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

example/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# typical command:
33
# cmake -DInfoLogger_DIR=path/to/infologger/lib/cmake/InfoLogger ..
44

5+
project (InfoLoggerExample)
6+
cmake_minimum_required(VERSION 3.17)
7+
58
find_package(InfoLogger REQUIRED)
69
set(CMAKE_CXX_STANDARD 14)
710
add_executable(exampleLog exampleLog.cxx)

example/exampleLog.cxx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,32 @@
99
// or submit itself to any jurisdiction.
1010

1111
#include <InfoLogger/InfoLogger.hxx>
12+
13+
// optionnaly, use the helper macros
14+
#include <InfoLogger/InfoLoggerMacros.hxx>
15+
1216
using namespace AliceO2::InfoLogger;
1317
int main()
1418
{
19+
// create handle to infologger system
1520
InfoLogger theLog;
1621

22+
// or, alternatively, to start infologger library in debug mode on stdout
23+
// (can also be done at runtime by setting environment O2_INFOLOGGER_MODE)
24+
// outputMode can be one of stdout, debug, infoLoggerD, ...
25+
// InfoLogger theLog("outputMode=debug");
26+
27+
// optionnaly, customize some of the "static" fields
28+
// to be applied to all messages
29+
InfoLoggerContext theLogContext;
30+
theLogContext.setField(InfoLoggerContext::FieldName::Facility, "myTestFacility");
31+
theLog.setContext(theLogContext);
32+
33+
// log a message
1734
theLog.log("infoLogger message test");
35+
36+
// log a warning with code 1234 for developers
37+
theLog.log(LogWarningDevel_(1234), "this is a test warning message");
38+
1839
return 0;
1940
}

0 commit comments

Comments
 (0)