Skip to content

Commit 154b9de

Browse files
authored
Merge pull request #33 from sy-c/master
added central reference for error codes
2 parents 3b0ff8c + 3cdeed6 commit 154b9de

File tree

4 files changed

+69
-1
lines changed

4 files changed

+69
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ foreach (f ${TEST_SRCS})
382382
message ("${exe}")
383383
add_executable(${exe} ${f} ${INFOLOGGER_LIB_OBJECTS} $<TARGET_OBJECTS:objCommonTimer>)
384384
target_link_libraries(${exe} InfoLogger)
385-
target_include_directories(${exe} PRIVATE ${COMMON_STANDALONE_INCLUDE_DIRS})
385+
target_include_directories(${exe} PRIVATE ${COMMON_STANDALONE_INCLUDE_DIRS} src)
386386
add_test(NAME ${test_name} COMMAND ${exe})
387387
endforeach()
388388

doc/releaseNotes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ This file describes the main feature changes for each InfoLogger released versio
2323
## v1.3.5 - 06/09/2019
2424
- added process stdout/stderr capture and redirection to infologger
2525
- added infoLoggerTester to check full message pipeline from client to server and database.
26+
27+
## next version
28+
- added header file InfoLoggerErrorCodes.h to reference centrally the definition of error code ranges reserved specifically for each o2 module, and possibly the individual description / documentation of each error code.

src/InfoLoggerErrorCodes.h

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
12+
// This file is used to define the error codes used in InfoLogger
13+
// Some ranges are reserved for each external module making use of error codes.
14+
// Error codes are referenced and documented centrally here.
15+
16+
17+
namespace AliceO2
18+
{
19+
namespace InfoLogger
20+
{
21+
22+
23+
// Structure to describe the ranges of error codes
24+
typedef struct {
25+
const int errorCodeMin; // minimum error code
26+
const int errorCodeMax; // maximum error code max
27+
const char *component; // component associated to this error code range
28+
const char *url; // link to corresponding troubleshooting documentation
29+
} ErrorCodeRange;
30+
31+
// Static array defining reserved error code ranges to be used by the o2 modules.
32+
// Error code definitions within each range is left to the corresponding package.
33+
// Terminated by a null entry
34+
static constexpr ErrorCodeRange errorCodeRanges[]={
35+
{ 0, 999, "reserved for general purpose", "" },
36+
{ 1000, 1999, "infoLogger", "" },
37+
{ 2000, 2999, "aliECS", "" },
38+
{ 0, 0, nullptr, nullptr}
39+
};
40+
41+
// Constant giving the number of error code ranges defined in errorCodeRanges[]
42+
static int numberOfErrorCodeRanges = sizeof(errorCodeRanges)/sizeof(ErrorCodeRange)-1;
43+
44+
// Structure to describe each error code
45+
typedef struct {
46+
const int errorCode; // minimum error code
47+
const char *description; // short description of the error / hint
48+
const char *url; // link to corresponding troubleshooting documentation
49+
} ErrorCode;
50+
51+
// Static array defining available error codes
52+
// Terminated by a null entry
53+
static constexpr ErrorCode errorCodes[]={
54+
{ 0, nullptr, nullptr}
55+
};
56+
57+
// Constant giving the number of error codes defined in errorCodes[]
58+
static int numberOfErrorCodes = sizeof(errorCodes)/sizeof(ErrorCode)-1;
59+
60+
61+
// end namespace InfoLogger
62+
}
63+
// end namespace AliceO2
64+
}

test/testInfoLogger.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include <InfoLogger/InfoLogger.hxx>
1717
#include <boost/format.hpp>
18+
#include <InfoLoggerErrorCodes.h>
1819

1920
using namespace AliceO2::InfoLogger;
2021

0 commit comments

Comments
 (0)