From 0b55f0b12f6f75c75cc7279f2984201b4018264c Mon Sep 17 00:00:00 2001 From: Sylvain Chapeland Date: Mon, 9 Sep 2019 16:00:00 +0200 Subject: [PATCH 1/2] added InfoLoggerErrorCodes.h to reserve specific ranges for each o2 module --- src/InfoLoggerErrorCodes.h | 64 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/InfoLoggerErrorCodes.h diff --git a/src/InfoLoggerErrorCodes.h b/src/InfoLoggerErrorCodes.h new file mode 100644 index 0000000..175ab9e --- /dev/null +++ b/src/InfoLoggerErrorCodes.h @@ -0,0 +1,64 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + + +// This file is used to define the error codes used in InfoLogger +// Some ranges are reserved for each external module making use of error codes. +// Error codes are referenced and documented centrally here. + + +namespace AliceO2 +{ +namespace InfoLogger +{ + + +// Structure to describe the ranges of error codes +typedef struct { + const int errorCodeMin; // minimum error code + const int errorCodeMax; // maximum error code max + const char *component; // component associated to this error code range + const char *url; // link to corresponding troubleshooting documentation +} ErrorCodeRange; + +// Static array defining reserved error code ranges to be used by the o2 modules. +// Error code definitions within each range is left to the corresponding package. +// Terminated by a null entry +static constexpr ErrorCodeRange errorCodeRanges[]={ + { 0, 999, "reserved for general purpose", "" }, + { 1000, 1999, "infoLogger", "" }, + { 2000, 2999, "aliECS", "" }, + { 0, 0, nullptr, nullptr} +}; + +// Constant giving the number of error code ranges defined in errorCodeRanges[] +static int numberOfErrorCodeRanges = sizeof(errorCodeRanges)/sizeof(ErrorCodeRange)-1; + +// Structure to describe each error code +typedef struct { + const int errorCode; // minimum error code + const char *description; // short description of the error / hint + const char *url; // link to corresponding troubleshooting documentation +} ErrorCode; + +// Static array defining available error codes +// Terminated by a null entry +static constexpr ErrorCode errorCodes[]={ + { 0, nullptr, nullptr} +}; + +// Constant giving the number of error codes defined in errorCodes[] +static int numberOfErrorCodes = sizeof(errorCodes)/sizeof(ErrorCode)-1; + + +// end namespace InfoLogger +} +// end namespace AliceO2 +} From 3cdeed6b0370c2b1af72cd9b8b904ca27750a2b2 Mon Sep 17 00:00:00 2001 From: Sylvain Chapeland Date: Mon, 9 Sep 2019 16:00:09 +0200 Subject: [PATCH 2/2] added InfoLoggerErrorCodes.h to reserve specific ranges for each o2 module --- CMakeLists.txt | 2 +- doc/releaseNotes.md | 3 +++ test/testInfoLogger.cxx | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d4086a..399673a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -382,7 +382,7 @@ foreach (f ${TEST_SRCS}) message ("${exe}") add_executable(${exe} ${f} ${INFOLOGGER_LIB_OBJECTS} $) target_link_libraries(${exe} InfoLogger) - target_include_directories(${exe} PRIVATE ${COMMON_STANDALONE_INCLUDE_DIRS}) + target_include_directories(${exe} PRIVATE ${COMMON_STANDALONE_INCLUDE_DIRS} src) add_test(NAME ${test_name} COMMAND ${exe}) endforeach() diff --git a/doc/releaseNotes.md b/doc/releaseNotes.md index 567c6c4..169f62c 100644 --- a/doc/releaseNotes.md +++ b/doc/releaseNotes.md @@ -23,3 +23,6 @@ This file describes the main feature changes for each InfoLogger released versio ## v1.3.5 - 06/09/2019 - added process stdout/stderr capture and redirection to infologger - added infoLoggerTester to check full message pipeline from client to server and database. + +## next version +- 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. diff --git a/test/testInfoLogger.cxx b/test/testInfoLogger.cxx index 939b2d7..520e22e 100644 --- a/test/testInfoLogger.cxx +++ b/test/testInfoLogger.cxx @@ -15,6 +15,7 @@ #include #include +#include using namespace AliceO2::InfoLogger;