FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents
logging_api.cpp File Reference
#include <utils/logging/logging_api.hpp>
#include <limits.h>
#include <unistd.h>
#include <sys/uio.h>
#include <errno.h>
#include <sys/mman.h>
#include <syslog.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <memory.h>
#include <utils/io/mapped_file.h>
#include <utils/shared_vars/shared_variable.hpp>
#include <utils/base/text2int.h>
#include <utils/base/atomic_values.h>

Macros

#define INVALID_HANDLE_VALUE   -1
 
#define MAX_SUPPORTED_COMPONENTS   64
 
#define MAX_DISTINCT_FLAG_ALIASES   128
 
#define MAX_SEVERITY_LABEL_LEN   12 /* keep as small as possible to fit as much as possible within a cache line */
 
#define LEVEL_BITS_AVAILABLE   (30-4)
 
#define USER_LEVEL_SUBSCRIPT   7
 
#define MAX_ELEMENT_TOTAL   ((LOG_MAX_ARGUMENT_TOTAL * 2) + 9)
 Maximum possible iovec elements, usually leading text and the argument data. More...
 
#define ADD_IOV_ELEMENT(ptr, len, testCount)
 Convenience macro to add element to iovec array. More...
 

Functions

LogManager realize_STDOUT_Manager & stdoutName ("USE_STDOUT_THREAD"), "stdout", ~0U, getEnvironValue("STDOUT_MAX_LENGTH", 4608), nullptr, getEnvironValue("STDOUT_LINES", 64) *LogManager::MAX_LOG_LINE_LENGTH
 
LogManager realize_STDERR_Manager & stderrName ("USE_STDERR_THREAD"), "stderr", ~0U, getEnvironValue("STDERR_MAX_LENGTH", 4608), nullptr, getEnvironValue("STDERR_LINES", 64) *LogManager::MAX_LOG_LINE_LENGTH
 
LogMaskType_t COMPONENT_LOG_MASK() app ("app_logMask", &DEFAULT_sharedMemoryVariableManager, COMPONENT_LEVEL(app, defaultMask))
 
LogMaskType_t COMPONENT_LOG_MASK() io ("io_logMask", &DEFAULT_sharedMemoryVariableManager, COMPONENT_LEVEL(io, warn)|COMPONENT_LEVEL(io, error)|COMPONENT_LEVEL(io, fatal))
 

Variables

struct LogSubsystemInfo default_LogSubsystemInfo
 Default descriptive information for Logging subsystem. More...
 
SMV_StandaloneNumeric< uint32_t > coalesceCount ("coalesceIOVEC")
 
struct BitFlagAndName logFlagBits [MAX_DISTINCT_FLAG_ALIASES]
 

Macro Definition Documentation

◆ ADD_IOV_ELEMENT

#define ADD_IOV_ELEMENT (   ptr,
  len,
  testCount 
)
Value:
if ((testCount == 1) && OME_EXPECT_FALSE(elementTotal >= (MAX_ELEMENT_TOTAL - 1))) { \
std::cerr << "Too many elements: " << (elementTotal) << std::endl; \
} else do { \
outputElements[elementTotal].iov_base = (void *)(ptr); \
outputElements[elementTotal].iov_len = len; \
totalRecordLen += static_cast<uint32_t>(len); \
elementTotal += 1; \
} while (0)

Convenience macro to add element to iovec array.

Parameters
ptrpoints to the block of data
lenspecifies the length
testCountis a constant that indicates if the test for too many vector elements should be included. This is evaluated at compile time and can eliminate the test overhead completely.

◆ INVALID_HANDLE_VALUE

#define INVALID_HANDLE_VALUE   -1

◆ LEVEL_BITS_AVAILABLE

#define LEVEL_BITS_AVAILABLE   (30-4)

◆ MAX_DISTINCT_FLAG_ALIASES

#define MAX_DISTINCT_FLAG_ALIASES   128

◆ MAX_ELEMENT_TOTAL

#define MAX_ELEMENT_TOTAL   ((LOG_MAX_ARGUMENT_TOTAL * 2) + 9)

Maximum possible iovec elements, usually leading text and the argument data.

◆ MAX_SEVERITY_LABEL_LEN

#define MAX_SEVERITY_LABEL_LEN   12 /* keep as small as possible to fit as much as possible within a cache line */

◆ MAX_SUPPORTED_COMPONENTS

#define MAX_SUPPORTED_COMPONENTS   64

◆ USER_LEVEL_SUBSCRIPT

#define USER_LEVEL_SUBSCRIPT   7

Function Documentation

◆ app()

◆ io()

◆ stderrName()

LogManager realize_STDERR_Manager& stderrName ( "USE_STDERR_THREAD"  )

◆ stdoutName()

LogManager realize_STDOUT_Manager& stdoutName ( "USE_STDOUT_THREAD"  )

Variable Documentation

◆ coalesceCount

SMV_StandaloneNumeric<uint32_t> coalesceCount("coalesceIOVEC")

◆ logFlagBits

struct BitFlagAndName logFlagBits[MAX_DISTINCT_FLAG_ALIASES]
Initial value:
= {
{ LogMessageRecord::LOG_SEVERITY_USER * (1 << 1), {".user1"} },
{ LogMessageRecord::LOG_SEVERITY_USER * (1 << 2), {".user2"} },
{ LogMessageRecord::LOG_SEVERITY_USER * (1 << 3), {".user3"} },
{ LogMessageRecord::LOG_SEVERITY_USER * (1 << 4), {".user4"} },
{ LogMessageRecord::LOG_SEVERITY_USER * (1 << 5), {".user5"} },
{ LogMessageRecord::LOG_SEVERITY_USER * (1 << 6), {".user6"} },
{ 0x7fffffffU, {".all"} },
{ 0, {""} }
}
LogMessageRecord::LOG_SEVERITY_WARN
@ LOG_SEVERITY_WARN
Definition: logging_api.hpp:1067
LogMessageRecord::LOG_SEVERITY_DEBUG
@ LOG_SEVERITY_DEBUG
Definition: logging_api.hpp:1065
LogMessageRecord::LOG_SEVERITY_TRACE
@ LOG_SEVERITY_TRACE
Definition: logging_api.hpp:1064
LogMessageRecord::LOG_SEVERITY_ERROR
@ LOG_SEVERITY_ERROR
Definition: logging_api.hpp:1068
LogMessageRecord::LOG_SEVERITY_FATAL
@ LOG_SEVERITY_FATAL
Definition: logging_api.hpp:1069
OME_EXPECT_FALSE
#define OME_EXPECT_FALSE(expr)
Annotation macro for conditional expression expected to be false.
Definition: compiler_hints.h:540
LogMessageRecord::LOG_SEVERITY_USER
@ LOG_SEVERITY_USER
Definition: logging_api.hpp:1070
MAX_ELEMENT_TOTAL
#define MAX_ELEMENT_TOTAL
Maximum possible iovec elements, usually leading text and the argument data.
Definition: logging_api.cpp:1268
LogMessageRecord::LOG_SEVERITY_INFO
@ LOG_SEVERITY_INFO
Definition: logging_api.hpp:1066
Generated: Tue Jul 28 2020 16:03:26
Support Information