Skip to content

Commit

Permalink
Merge pull request #33 from sy-c/master
Browse files Browse the repository at this point in the history
added central reference for error codes
  • Loading branch information
sy-c authored Sep 9, 2019
2 parents 3b0ff8c + 3cdeed6 commit 154b9de
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ foreach (f ${TEST_SRCS})
message ("${exe}")
add_executable(${exe} ${f} ${INFOLOGGER_LIB_OBJECTS} $<TARGET_OBJECTS:objCommonTimer>)
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()

Expand Down
3 changes: 3 additions & 0 deletions doc/releaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
64 changes: 64 additions & 0 deletions src/InfoLoggerErrorCodes.h
Original file line number Diff line number Diff line change
@@ -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
}
1 change: 1 addition & 0 deletions test/testInfoLogger.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include <InfoLogger/InfoLogger.hxx>
#include <boost/format.hpp>
#include <InfoLoggerErrorCodes.h>

using namespace AliceO2::InfoLogger;

Expand Down

0 comments on commit 154b9de

Please sign in to comment.