Go to the documentation of this file. 1 #ifndef _LOGGING_API_HPP_
2 #define _LOGGING_API_HPP_ "$Id: logging_api.hpp 456 2020-07-23 20:25:49Z geoff $"
51 #define _WIN32_WINNT 0x0600
53 #if _WIN32_WINNT < 0x0600
54 #warning "Need to support Windows Vista or later for inet_ntop() support"
61 #include <arpa/inet.h>
62 #include <sys/socket.h>
89 #ifndef USE_GETTID_FOR_THREADID
90 #define USE_GETTID_FOR_THREADID 0
92 #if __linux__ && USE_GETTID_FOR_THREADID == 1
93 #include <sys/syscall.h>
96 #ifndef COMPILE_DEBUG_LEVEL
97 #define COMPILE_DEBUG_LEVEL ~0
100 #define DEFAULT_LOG_DIRECTORY_ENVIRONMENT_VARIABLE "LOGDIR"
103 #define LOGFILE_BFR_MAGIC_NUMBER "LOGCBFR"
211 #define SiR(x) ((StringInROM) (x))
228 bfrLen = (uint_fast32_t) strlen(bfr);
243 if (clipAtNull ==
false) {
247 const char *end = (
const char *) memchr(bfr, 0, len);
248 bfrLen = (end ==
nullptr) ? len : end - bfr;
255 #define _DEFAULT_ESCAPED_CHARACTERS "\"\n\r\t\b\\"
256 #define _DEFAULT_REPLACEMENT_CHARACTERS "\\\"\0\\n\0\\r\0\\t\0\\b\0\\\\\0"
258 #define _DEFAULT_NULL_REPLACEMENT "\\0"
295 const char *start = escapeUsing;
296 uint_fast16_t quotableLen = 0;
298 const unsigned char c =
reinterpret_cast<const unsigned char *
>(quoteTheseChars)[quotableLen];
301 while (*start !=
'\0') {
311 }
while (quoteTheseChars[quotableLen] !=
'\0');
312 if (convertNULL !=
nullptr) {
316 while (*start !=
'\0') {
347 initEscapes(quoteTheseChars, escapeUsing, convertNULL);
411 const char *quoteTheseChars,
418 bfrLen = (uint_fast32_t) strlen(bfr);
432 bfrLen = (uint_fast32_t) strlen(bfr);
439 const char *quoteTheseChars,
465 const char *quoteTheseChars,
472 bfrLen = (uint_fast32_t) bfr.size();
484 bfrLen = (uint_fast32_t) bfr.size();
491 const char *quoteTheseChars,
547 #define SUGGESTED_DEFAULT_MAX_LOG_LINES 1024
714 const int argc,
const char *argv[],
715 const char *componentName=
nullptr,
723 uint_fast8_t useSeparateThreads,
unsigned char *region,
size_t bytes);
756 const char *
app, uint_fast32_t filenameCreateFlags,
758 uint_fast8_t enableMap, uint_fast8_t useSeparateThreads,
759 size_t desiredRegionSize=0,
size_t reserveAtEnd=0,
831 uint_fast32_t logLinePrefixMask=~0U,
883 if (bufferLen !=
nullptr) {
906 const void *data,
size_t len);
948 if (routine !=
nullptr) {
968 (*getTimestampRoutine)(timestamp,
this);
1007 if (defaultMask != 0) {
1078 char asChars[
sizeof(
char *)];
1079 unsigned char bytes[
sizeof(
char *)];
1105 LOG_ARG_TYPE_POINTER=128,
1106 LOG_ARG_TYPE_ROM_TEXT = LOG_ARG_TYPE_POINTER | LOG_ARG_TYPE_TEXT,
1107 LOG_ARG_TYPE_TEXT_FRAGMENT = LOG_ARG_TYPE_POINTER | LOG_ARG_TYPE_CHAR,
1108 LOG_ARG_TYPE_HEX_FRAGMENT = LOG_ARG_TYPE_POINTER | LOG_ARG_TYPE_CHAR | LOG_ARG_TYPE_FLOAT,
1109 LOG_ARG_TYPE_HEX_FRAGMENT_UPPER = LOG_ARG_TYPE_POINTER | LOG_ARG_TYPE_CHAR | LOG_ARG_TYPE_DOUBLE,
1110 LOG_ARG_TYPE_POSIX_NANOSECONDS = 256 | LOG_ARG_TYPE_UINT64,
1111 LOG_ARG_TYPE_FIXED_POINT = 512 | LOG_ARG_TYPE_UINT64
1125 struct timespec timestamp;
1139 } argList[LOG_MAX_ARGUMENT_TOTAL];
1153 const char *line,
const char *separators=
",;",
1166 static int define_commandline_flag(
const char *flagName,
1168 const char *label=
nullptr);
1200 int argc,
const char *argv[],
int *newArgc,
const char **newArgv);
1208 static const char *getSeverityLabel(uint_fast32_t level);
1211 const char *atFileName, uint32_t atLineNumber,
1215 sourceFile = atFileName;
1217 sourceFileNameLen = fileNameLen;
1220 sourceFileNameLen = strlen(atFileName);
1222 sourceFileNameLen = 0;
1225 sourceLine = atLineNumber;
1226 importanceLevel = importanceFlags;
1227 logLineFormat =
nullptr;
1228 generatedOffset = 0;
1229 argCountExceeded = 0;
1231 #if __linux__ && USE_GETTID_FOR_THREADID == 1
1232 threadId = (uint64_t) syscall(__NR_gettid);
1234 threadId = (uint64_t) pthread_self();
1237 threadId = (uint64_t) GetCurrentThreadId();
1274 char *dest = generatedFormatLine + generatedOffset;
1279 case LOG_ARG_TYPE_POINTER:
1281 memcpy(dest,
"%B", 2);
1283 memcpy(dest,
"%p", 2);
1287 case LOG_ARG_TYPE_TEXT_FRAGMENT:
1288 memcpy(dest,
"%B", 2);
1291 case LOG_ARG_TYPE_HEX_FRAGMENT:
1292 memcpy(dest,
"%x", 2);
1295 case LOG_ARG_TYPE_HEX_FRAGMENT_UPPER:
1296 memcpy(dest,
"%X", 2);
1299 case LOG_ARG_TYPE_ROM_TEXT:
1302 memcpy(dest,
"%s", 2);
1308 case LOG_ARG_TYPE_TEXT: {
1311 for(uint_fast32_t _c=0;_c<argRec.
argLen;_c+=1) {
1315 *(dest++) = *(src++);
1320 case LOG_ARG_TYPE_CHAR:
1322 for(uint_fast32_t _c=0;_c<argRec.
argLen;_c+=1) {
1331 case LOG_ARG_TYPE_FLOAT:
1332 memcpy(dest,
"%g", 2);
1335 case LOG_ARG_TYPE_DOUBLE:
1336 memcpy(dest,
"%g", 2);
1343 case LOG_ARG_TYPE_INT32:
1344 memcpy(dest,
"%d", 2);
1347 case LOG_ARG_TYPE_UINT32:
1348 memcpy(dest,
"%u", 2);
1352 case LOG_ARG_TYPE_INT64:
1356 memcpy(dest,
"%ld", 4);
1359 case LOG_ARG_TYPE_UINT64:
1360 memcpy(dest,
"%lu", 4);
1363 case LOG_ARG_TYPE_POSIX_NANOSECONDS: {
1364 memcpy(dest,
"%N", 2);
1368 case LOG_ARG_TYPE_FIXED_POINT:
1369 memcpy(dest,
"%P", 2);
1373 std::cerr <<
"unknown field type: " << argRec.
argBaseType << std::endl;
1378 logLineFormat = generatedFormatLine;
1379 generatedOffset = (uint32_t) (dest - generatedFormatLine);
1380 return (generatedOffset);
1452 size_t *returnLen=
nullptr, uint32_t singleThreaded=
false);
1483 template <
typename T>
void emitOverflowError(
const T &arg)
OME_COLD_ROUTINE;
1492 " argument=" << arg <<
1497 #define _ADD_NEW_LOG_ARG(typeEnum,member) \
1498 LogMessageRecord::ArgumentRecord &argRec = logRec.argList[logRec.argCount]; \
1499 argRec.logArgs. member = arg; \
1500 argRec.argLen = sizeof(arg); \
1501 argRec.argBaseType = typeEnum; \
1502 logRec.argCount += 1
1504 #define _ADD_NEW_LOG_ARG_WITH_VALUE_AND_LEN(typeEnum,member,val,len) \
1505 LogMessageRecord::ArgumentRecord &argRec = logRec.argList[logRec.argCount]; \
1506 argRec.logArgs. member = val; \
1507 argRec.argLen = len; \
1508 argRec.argBaseType = typeEnum; \
1509 logRec.argCount += 1
1513 #if (__clang__ != 0)
1556 #if (__clang__ != 0)
1680 for(uint_fast8_t i=0;i<arg.
bfrLen;i+=1) {
1705 for(uint_fast8_t i=0;i<arg.
bfrLen;i+=1) {
1806 #define __EXPLICIT_LOG_MESSAGE_BODY { \
1807 if (OME_EXPECT_FALSE(logRec.argCount >= LogMessageRecord::LOG_MAX_ARGUMENT_TOTAL)) { \
1808 logRec.emitOverflowError(arg); \
1811 addLogArg(logRec, arg); \
1812 logRec.generateFormatString(logRec.argCount - 1); \
1878 #if (__clang__ != 0)
1930 os << (
const char *) arg;
1941 for(uint_fast32_t i=0;i<arg.
bfrLen;i+=1) {
1954 const unsigned char *bfr =
static_cast<const unsigned char *
>(arg.
dataBfr);
1955 for(uint_fast32_t i=0;i<arg.
bfrLen;i+=1) {
1968 const unsigned char *bfr =
static_cast<const unsigned char *
>(arg.
dataBfr);
1970 for(uint_fast32_t i=0;i<arg.
bfrLen;i+=1) {
1975 for(uint_fast32_t i=0;i<arg.
bfrLen;i+=1) {
1993 const unsigned char *bfr =
reinterpret_cast<const unsigned char *
>(arg.
textBfr);
1994 for(uint_fast32_t i=0;i<arg.
bfrLen;i+=1) {
1995 unsigned char c = bfr[i];
1999 }
else if (
l != 0) {
2055 const unsigned char *bfr =
reinterpret_cast<const unsigned char *
>(arg.
textBfr);
2057 uint_fast32_t startOffset = 0;
2058 for(uint_fast32_t i=0;i<arg.
bfrLen;i+=1) {
2059 unsigned char c = bfr[i];
2062 uint_fast32_t priorBlockLen = i - startOffset;
2063 if (priorBlockLen != 0) {
2071 startOffset = i + 1;
2074 uint_fast32_t blockLen = arg.
bfrLen - startOffset;
2087 #define AS_TEXT_BUFFER(s,...) TextBlock_struct(s,__VA_ARGS__)
2100 #define AS_ESCAPED_TEXT_BUFFER(...) EscapedTextBlock_struct(__VA_ARGS__)
2112 #define AS_ESCAPED_TEXT_CHARACTER(...) EscapedTextBlock_struct(__VA_ARGS__)
2122 #define AS_BINARY_BUFFER(d,l) BinaryBlock_struct(d,l)
2135 #define AS_HEXADECIMAL_BUFFER(d,...) HexadecimalBlock_struct(d,__VA_ARGS__)
2158 const char *label=
nullptr)
2188 const char *label =
"replumb");
2193 #endif // end ReplumbAndLog
2200 #define _LOGAPI_APPEND_TOKEN(component,suffix) component ## suffix
2207 #define LOGAPI_APPEND_TOKEN(component,suffix) _LOGAPI_APPEND_TOKEN(component,suffix)
2214 #define COMPONENT_LOG_MASK(component) LOGAPI_APPEND_TOKEN(component,_logLevelMask)
2217 #define THIS_COMPONENT_LOG_MASK COMPONENT_LOG_MASK(THIS_COMPONENT)
2224 #ifndef ISABLE_ALL_LOG_MASK
2225 #define ISABLE_ALL_LOG_MASK 0
2250 #define DISABLE_COMPONENT_LOG_MASK(component) LOGAPI_APPEND_TOKEN(ISABLE_, LOGAPI_APPEND_TOKEN(component,_logMask))
2271 #define COMPONENT_LOG_ENABLED(component, mask) OME_EXPECT( ( ((mask & LOGAPI_APPEND_TOKEN(component,_disableMask)) == 0 ) && (((uint32_t)(COMPONENT_LOG_MASK(component)) & (mask & ~LogMessageRecord::AND_SPECIAL_MASK)) == (mask & ~LogMessageRecord::AND_SPECIAL_MASK)) ), (static_cast<uint_fast32_t>(mask) & static_cast<uint_fast32_t>(LogMessageRecord::LOG_SEVERITY_DEBUG | LogMessageRecord::LOG_SEVERITY_TRACE | LogMessageRecord::LOG_SEVERITY_USER)) )
2281 #define _COMPONENT_LEVEL(component, level) component ## _ ## level
2288 #define COMPONENT_LEVEL(component, level) _COMPONENT_LEVEL(component, level)
2294 #define THIS_COMPONENT_LEVEL(level) COMPONENT_LEVEL(THIS_COMPONENT, level)
2302 #define ENABLE_COMPONENT_LOG_LEVEL(component, level) COMPONENT_LOG_MASK(component) = (uint32_t) COMPONENT_LOG_MASK(component) | COMPONENT_LEVEL(component,level)
2310 #define DISABLE_COMPONENT_LOG_LEVEL(component, level) COMPONENT_LOG_MASK(component) = (uint32_t) COMPONENT_LOG_MASK(component) & ~ COMPONENT_LEVEL(component,level)
2322 #define COMPONENT_USER_LEVEL(component, baseLevel, N) (COMPONENT_LEVEL(component, baseLevel) | (COMPONENT_LEVEL(component, user) * (1 << N)))
2332 #define THIS_COMPONENT_USER_LEVEL(baseLevel,N) COMPONENT_USER_LEVEL(THIS_COMPONENT, baseLevel, N)
2346 #define DECLARE_COMPONENT_USER_LOG_MASK(component,name,baseLevel,N) enum { COMPONENT_LEVEL(component, name) = COMPONENT_USER_LEVEL(component,baseLevel,N) }
2381 #define _DEFINE_COMPONENT_LOG_MASKS(component) enum { \
2382 component ## _none = 0, \
2383 component ## _trace = LogMessageRecord::LOG_SEVERITY_TRACE, \
2384 component ## _debug = LogMessageRecord::LOG_SEVERITY_DEBUG, \
2385 component ## _info = LogMessageRecord::LOG_SEVERITY_INFO, \
2386 component ## _information = LogMessageRecord::LOG_SEVERITY_INFO, \
2387 component ## _warn = LogMessageRecord::LOG_SEVERITY_WARN, \
2388 component ## _warning = LogMessageRecord::LOG_SEVERITY_WARN, \
2389 component ## _warningAndSyslog = LogMessageRecord::LOG_SEVERITY_WARN | LogMessageRecord::AND_USE_SYSLOG, \
2390 component ## _warningAndStderr = LogMessageRecord::LOG_SEVERITY_WARN | LogMessageRecord::AND_USE_STDERR, \
2391 component ## _warningAndBroadcast = LogMessageRecord::LOG_SEVERITY_WARN | LogMessageRecord::AND_USE_SYSLOG | LogMessageRecord::AND_USE_STDERR, \
2392 component ## _error = LogMessageRecord::LOG_SEVERITY_ERROR, \
2393 component ## _errorAndSyslog = LogMessageRecord::LOG_SEVERITY_ERROR | LogMessageRecord::AND_USE_SYSLOG, \
2394 component ## _errorAndStderr = LogMessageRecord::LOG_SEVERITY_ERROR | LogMessageRecord::AND_USE_STDERR, \
2395 component ## _errorAndBroadcast = LogMessageRecord::LOG_SEVERITY_ERROR | LogMessageRecord::AND_USE_SYSLOG | LogMessageRecord::AND_USE_STDERR, \
2396 component ## _fatal = LogMessageRecord::LOG_SEVERITY_FATAL, \
2397 component ## _fatalAndSyslog = LogMessageRecord::LOG_SEVERITY_FATAL | LogMessageRecord::AND_USE_SYSLOG, \
2398 component ## _fatalAndStderr = LogMessageRecord::LOG_SEVERITY_FATAL | LogMessageRecord::AND_USE_STDERR, \
2399 component ## _fatalAndBroadcast = LogMessageRecord::LOG_SEVERITY_FATAL | LogMessageRecord::AND_USE_SYSLOG | LogMessageRecord::AND_USE_STDERR, \
2400 component ## _user = LogMessageRecord::LOG_SEVERITY_USER, \
2401 component ## _userInfo1 = COMPONENT_USER_LEVEL(component, info, 1), \
2402 component ## _userInfo2 = COMPONENT_USER_LEVEL(component, info, 2), \
2403 component ## _userInfo3 = COMPONENT_USER_LEVEL(component, info, 3), \
2404 component ## _userInfo4 = COMPONENT_USER_LEVEL(component, info, 4), \
2405 component ## _userInfo5 = COMPONENT_USER_LEVEL(component, info, 5), \
2406 component ## _userInfo6 = COMPONENT_USER_LEVEL(component, info, 6), \
2407 component ## _userDebug1 = COMPONENT_USER_LEVEL(component, debug, 1), \
2408 component ## _userDebug2 = COMPONENT_USER_LEVEL(component, debug, 2), \
2409 component ## _userDebug3 = COMPONENT_USER_LEVEL(component, debug, 3), \
2410 component ## _userDebug4 = COMPONENT_USER_LEVEL(component, debug, 4), \
2411 component ## _userDebug5 = COMPONENT_USER_LEVEL(component, debug, 5), \
2412 component ## _userDebug6 = COMPONENT_USER_LEVEL(component, debug, 6), \
2413 component ## _userTrace1 = COMPONENT_USER_LEVEL(component, trace, 1), \
2414 component ## _userTrace2 = COMPONENT_USER_LEVEL(component, trace, 2), \
2415 component ## _userTrace3 = COMPONENT_USER_LEVEL(component, trace, 3), \
2416 component ## _userTrace4 = COMPONENT_USER_LEVEL(component, trace, 4), \
2417 component ## _userTrace5 = COMPONENT_USER_LEVEL(component, trace, 5), \
2418 component ## _userTrace6 = COMPONENT_USER_LEVEL(component, trace, 6), \
2419 component ## _userLevel1 = COMPONENT_USER_LEVEL(component, none, 1), \
2420 component ## _userLevel2 = COMPONENT_USER_LEVEL(component, none, 2), \
2421 component ## _userLevel3 = COMPONENT_USER_LEVEL(component, none, 3), \
2422 component ## _userLevel4 = COMPONENT_USER_LEVEL(component, none, 4), \
2423 component ## _userLevel5 = COMPONENT_USER_LEVEL(component, none, 5), \
2424 component ## _userLevel6 = COMPONENT_USER_LEVEL(component, none, 6), \
2425 component ## _basicLevels = component ## _trace | component ## _debug | \
2426 component ## _info | component ## _warn | component ## _error | \
2427 component ## _fatal, \
2428 component ## _defaultMask = LogMessageRecord::LOG_SEVERITY_INFO | \
2429 LogMessageRecord::LOG_SEVERITY_WARN | \
2430 LogMessageRecord::LOG_SEVERITY_ERROR | \
2431 LogMessageRecord::LOG_SEVERITY_FATAL, \
2432 ISABLE_ ## component ## _logMask0 = 0, \
2433 component ## _disableMask = ( LOGAPI_APPEND_TOKEN(DISABLE_COMPONENT_LOG_MASK(component),0) / 10 ) | ( ISABLE_ALL_LOG_MASK ), \
2434 component ## _all = 0x7fffffff }
2444 #define DEFINE_COMPONENT_LOG_MASKS(component) _DEFINE_COMPONENT_LOG_MASKS(component)
2458 #define AUTO_REGISTER_USER_LOG_MASK(component,name,label) static AutoRegisterLogLevelName LOGAPI_APPEND_TOKEN(autoRegFlag,LOGAPI_APPEND_TOKEN(component,name))(__LOGAPI_EXPAND_STRING2(name),COMPONENT_LEVEL(component,name),((COMPONENT_LEVEL(component,name) & COMPONENT_LEVEL(component,basicLevels)) ? 0 : label))
2484 #define DEFINE_COMPONENT_USER_LOG_MASK(component,name,baseLevel,N,label) DECLARE_COMPONENT_USER_LOG_MASK(component,name,baseLevel,N); AUTO_REGISTER_USER_LOG_MASK(component,name,label)
2492 #define _DECLARE_STANDARD_COMPONENT_VARS(component) \
2493 DEFINE_COMPONENT_LOG_MASKS(component); \
2494 extern SharedMemoryVariableNode component ## _namingNode ; \
2495 extern LogMaskType_t COMPONENT_LOG_MASK(component)
2503 #define DECLARE_STANDARD_COMPONENT_VARS(component) _DECLARE_STANDARD_COMPONENT_VARS(component)
2513 #define _DEFINE_STANDARD_COMPONENT_VARS_AND_MASK(component,maskValue) \
2514 SharedMemoryVariableNode component ## _namingNode( #component); \
2515 LogMaskType_t COMPONENT_LOG_MASK(component)( #component "_logMask", & component ## _namingNode, maskValue)
2527 #define DEFINE_STANDARD_COMPONENT_VARS_AND_MASK(component,maskValue) _DEFINE_STANDARD_COMPONENT_VARS_AND_MASK(component,maskValue)
2543 #define DEFINE_STANDARD_COMPONENT_VARS_AND_DEFAULT(component,defaultMaskName) \
2544 _DEFINE_STANDARD_COMPONENT_VARS_AND_MASK(component,COMPONENT_LEVEL(component,defaultMaskName))
2556 #define DEFINE_STANDARD_COMPONENT_VARS(component) DEFINE_STANDARD_COMPONENT_VARS_AND_DEFAULT(component,defaultMask)
2559 #define DEFINE_STANDARD_VARS_FOR_THIS_COMPONENT() DEFINE_STANDARD_COMPONENT_VARS(THIS_COMPONENT)
2562 #define __LOGAPI_EXPAND_STRING1(x) #x
2563 #define __LOGAPI_EXPAND_STRING2(x) __LOGAPI_EXPAND_STRING1(x)
2568 #define THIS_COMPONENT_AS_STRING __LOGAPI_EXPAND_STRING2(THIS_COMPONENT)
2574 #define AUTO_REGISTER_COMPONENT(componentName) static AutoRegisterLogComponent LOGAPI_APPEND_TOKEN(autoReg_,componentName) (COMPONENT_LOG_MASK(componentName), __LOGAPI_EXPAND_STRING2(componentName), LOGAPI_APPEND_TOKEN(componentName,_defaultMask));
2580 #define AUTO_REGISTER_THIS_COMPONENT() AUTO_REGISTER_COMPONENT(THIS_COMPONENT);
2595 #define PROCESS_COMMANDLINE_LOG_FLAGS(argc, argv) LogMessageRecord::process_commandline_log_flags(&default_LogSubsystemInfo, argc, argv, &argc, argv)
2612 #define _INIT_AND_OPEN_STANDARD_LOG(argc,argv,component,newArgc,newArgv) LogManager::initializeLogSubsystem(newArgc,newArgv,argc, argv, #component , & COMPONENT_LOG_MASK(component)); LogManager::newStandardLogFile()
2616 #define _STDOUT_FD 1
2617 #define _STDERR_FD 2
2618 #define _INVALID_DESCRIPTOR -1
2620 #define _STDIN_FD GetStdHandle(STD_INPUT_HANDLE)
2621 #define _STDOUT_FD GetStdHandle(STD_OUTPUT_HANDLE)
2622 #define _STDERR_FD GetStdHandle(STD_ERROR_HANDLE)
2623 #define _INVALID_DESCRIPTOR INVALID_HANDLE_VALUE
2626 #ifndef THIS_COMPONENT_LOG_MANAGER
2641 #define THIS_COMPONENT_LOG_MANAGER LogManager::DEFAULT_LogManager
2674 #define LOG_STREAM_OBJECT(n) \
2675 unsigned char LOGAPI_APPEND_TOKEN(_logBfr,n)[LogManager::MAX_LOG_LINE_LENGTH*8]; \
2676 LogManager LOGAPI_APPEND_TOKEN(_logMgr,n)(nullptr,_INVALID_DESCRIPTOR,false,"logstream",0,LogManager::MAX_LOG_LINE_LENGTH,LOGAPI_APPEND_TOKEN(_logBfr,n),sizeof( LOGAPI_APPEND_TOKEN(_logBfr,n) )); \
2677 LogMessageRecord LOGAPI_APPEND_TOKEN(logObj,n)(& LOGAPI_APPEND_TOKEN(_logMgr,n), 0, __FILE__, __LINE__, sizeof(__FILE__) - 1); LOGAPI_APPEND_TOKEN(logObj,n) << ""
2690 #define FORMAT_LOG_BUFFER(_var,src) do { \
2691 SharedBufferAllocRecord *_bRec = src.formatRecordAsText(0); \
2692 _var = (char *) src.getLogManager()->getBufferManager()->blockAddress(_bRec)
2696 #define RELEASE_LOG_BUFFER(src) src.getLogManager()->getBufferManager()->returnBlock(_bRec); } while (0)
2710 #define APPEND_LOG_BUFFER(dest,src) do { char *_addr; \
2711 FORMAT_LOG_BUFFER(_addr, src); \
2713 RELEASE_LOG_BUFFER(src); \
2730 #define _INIT_WITH_STANDARD_OUT(argc,argv,component,newArgc,newArgv) LogManager::initializeLogSubsystem(newArgc,newArgv,argc, argv, #component , & COMPONENT_LOG_MASK(component)); SharedMemoryVariableNode _logNamingRoot(#component); THIS_COMPONENT_LOG_MANAGER = LogManager::newLogToFileDescriptor(&_logNamingRoot, _STDOUT_FD, default_LogSubsystemInfo.defaultLogPrefix, default_LogSubsystemInfo.useThreads, 0, default_LogSubsystemInfo.maxPendingLogLines * LogManager::MAX_LOG_LINE_LENGTH)
2736 #define _SET_LOGMGR_FOR(output) SharedMemoryVariableNode _logNamingRoot ## output(#output); LogManager:: output ## _LogManager = LogManager::newLogToFileDescriptor(&_logNamingRoot ## output, _ ## output ## _FD, default_LogSubsystemInfo.defaultLogPrefix, default_LogSubsystemInfo.useThreads, 0, default_LogSubsystemInfo.maxPendingLogLines * LogManager::MAX_LOG_LINE_LENGTH);
2752 #define INIT_STANDARD_LOG_FOR_COMPONENT(argc,argv,appName,newArgc,newArgv) _INIT_AND_OPEN_STANDARD_LOG(argc,argv,appName,newArgc,newArgv)
2766 #define INIT_STANDARD_LOG_FOR_THIS_COMPONENT(argc,argv,newArgc,newArgv) INIT_STANDARD_LOG_FOR_COMPONENT(argc,argv,THIS_COMPONENT,newArgc,newArgv)
2777 #define ALWAYS_EMIT_MESSAGE_TO_LOG(logHandle, mask) do { \
2778 LogMessageRecord logObj(logHandle, mask, __FILE__, __LINE__, sizeof(__FILE__) - 1)
2786 #define ALWAYS_EMIT_MESSAGE(lvl) ALWAYS_EMIT_MESSAGE_TO_LOG(THIS_COMPONENT_LOG_MANAGER, THIS_COMPONENT_LEVEL(lvl))
2798 #define EMIT_CONDITIONAL_MESSAGE_FOR_COMPONENT_TO_LOG(component,mask,log) if (COMPONENT_LOG_ENABLED(component,mask)) ALWAYS_EMIT_MESSAGE_TO_LOG(log,mask)
2808 #define EMIT_CONDITIONAL_MESSAGE_FOR_COMPONENT(component,lvl) EMIT_CONDITIONAL_MESSAGE_FOR_COMPONENT_TO_LOG(component,COMPONENT_LEVEL(component,lvl),THIS_COMPONENT_LOG_MANAGER)
2816 #define EMIT_CONDITIONAL_MESSAGE(lvl) EMIT_CONDITIONAL_MESSAGE_FOR_COMPONENT(THIS_COMPONENT,lvl)
2822 #define LOG_MESSAGE_FORMAT(s) logObj.setLogFormat(s);
2828 #define LOG_ARG(arg) addLogArg(logObj, arg);
2835 #define LOG_BINARY_ARG(arg,len) addLogArg(logObj, arg,len);
2844 #define LOG_ARG_USING_BUFFER(arg,bfr,bfrLen) addLogArg(logObj, arg, bfr, bfrLen)
2852 #define AS_PLAIN_TEXT logObj.writeAsTextToBuffer(0); } while (0)
2858 #define AS_TIMESTAMPED_TEXT logObj.writeAsTextToBuffer(logObj.getLogManager()->getLogPrefixMask()); } while (0)
2871 #define AS_PREFIXED_TEXT(selectionMask) logObj.writeAsTextToBuffer(selectionMask); } while (0)
2874 #define AS_BINARY_RECORD logObj.writeAsBinaryToBuffer(logObj.getLogManager()->getLogPrefixMask()); } while (0)
2877 #define WITH_DATE_TIME_LEVEL logObj.writeAsTextToBuffer( LogMessageRecord::LOG_DATESTAMP | LogMessageRecord::LOG_TIMESTAMP | LogMessageRecord::LOG_ERROR_LEVEL); } while (0)
2880 #define WITH_TIME_LEVEL logObj.writeAsTextToBuffer(LogMessageRecord::LOG_TIMESTAMP | LogMessageRecord::LOG_ERROR_LEVEL); } while (0)
2888 #define LOG_WHEN_OSTREAM(stream,lvl) if (COMPONENT_LOG_ENABLED(THIS_COMPONENT,THIS_COMPONENT_LEVEL(lvl))) do { stream
2891 #define OSTREAM_ENDLINE "\n"; } while (0)
2903 #define LOG_TO_DESCRIPTOR(output,lvl) EMIT_CONDITIONAL_MESSAGE_FOR_COMPONENT_TO_LOG(THIS_COMPONENT,lvl,output ## _LogManager)
2910 #ifndef LOG_USING_OSTREAM
2917 #define LOG_ALWAYS(lvl) ALWAYS_EMIT_MESSAGE(lvl); logObj
2925 #define IFLOG_ALWAYS(lvl) if (THIS_COMPONENT_LOG_MANAGER != nullptr) ALWAYS_EMIT_MESSAGE(lvl); logObj
2933 #define LOG_WHEN(lvl) EMIT_CONDITIONAL_MESSAGE(lvl); logObj
2941 #define IFLOG_WHEN(lvl) if (THIS_COMPONENT_LOG_MANAGER != nullptr) EMIT_CONDITIONAL_MESSAGE(lvl); logObj
2948 #define ENDREC "\n"; logObj.writeAsTextToBuffer(logObj.getLogManager()->getLogPrefixMask()); } while (0)
2953 #define BINARY_ENDREC "\n"; logObj.writeAsBinaryToBuffer(logObj.getLogManager()->getLogPrefixMask()); } while (0)
2956 #define LOG_ENDLINE ENDREC
2959 #define BINARY_LOG_ENDLINE BINARY_ENDREC
2971 #define LOG_COMPONENT_INTO(mgrPtr,component,lvl) EMIT_CONDITIONAL_MESSAGE_FOR_COMPONENT_TO_LOG(component,COMPONENT_LEVEL(component,lvl),mgrPtr); logObj
2984 #define LOG_COMPONENT_ALWAYS_INTO(mgrPtr,component,lvl) ALWAYS_EMIT_MESSAGE_TO_LOG(mgrPtr,COMPONENT_LEVEL(component,lvl)); logObj
2992 #define LOG_INTO(mgrPtr,lvl) LOG_COMPONENT_INTO(mgrPtr,THIS_COMPONENT,lvl)
3000 #define LOG_ALWAYS_INTO(mgrPtr,lvl) LOG_COMPONENT_ALWAYS_INTO(mgrPtr,THIS_COMPONENT,lvl)
3007 #define LOG_COUT(lvl) LOG_INTO(LogManager::STDOUT_LogManager, lvl)
3014 #define LOG_CERR(lvl) LOG_INTO(LogManager::STDERR_LogManager, lvl)
3022 #define LOG_COMPONENT_COUT(component,lvl) LOG_COMPONENT_INTO(LogManager::STDOUT_LogManager,component,lvl)
3030 #define LOG_COMPONENT_CERR(component,lvl) LOG_COMPONENT_INTO(LogManager::STDERR_LogManager,component,lvl)
3039 #define LOG_COMPONENT(component,lvl) LOG_COMPONENT_INTO(THIS_COMPONENT_LOG_MANAGER,component,lvl)
3045 #define LOG_COMPONENT_ALWAYS(component,lvl) LOG_COMPONENT_ALWAYS_INTO(THIS_COMPONENT_LOG_MANAGER,component,lvl)
3065 #define IFLOG_COMPONENT(component,lvl) if (OME_EXPECT_TRUE(THIS_COMPONENT_LOG_MANAGER != nullptr)) LOG_COMPONENT_INTO(THIS_COMPONENT_LOG_MANAGER,component,lvl)
3073 #define IFLOG_COMPONENT_ALWAYS(component,lvl) if (OME_EXPECT_TRUE(THIS_COMPONENT_LOG_MANAGER != nullptr)) ALWAYS_EMIT_MESSAGE_TO_LOG(THIS_COMPONENT_LOG_MANAGER,COMPONENT_LEVEL(component,lvl)); logObj
3077 #define LOG_ALWAYS(lvl) do { LOG_USING_OSTREAM
3078 #define IFLOG_ALWAYS(level) if (THIS_COMPONENT_LOG_MANAGER != nullptr) { LOG_USING_OSTREAM
3080 #define LOG_WHEN(lvl) LOG_WHEN_OSTREAM(LOG_USING_OSTREAM,lvl)
3081 #define IFLOG_WHEN(lvl) if (THIS_COMPONENT_LOG_MANAGER != nullptr) LOG_WHEN_OSTREAM(LOG_USING_OSTREAM,lvl)
3083 #define LOG_COUT(lvl) LOG_WHEN_OSTREAM(std::cout,lvl)
3084 #define LOG_CERR(lvl) LOG_WHEN_OSTREAM(std::cerr,lvl)
3085 #define LOG_ENDLINE std::endl; } while (0)
3086 #define ENDREC LOG_ENDLINE
3088 #endif // LOG_USING_STREAM not defined (expected case)
3106 #define SPLIT_ACROSS_LINES(label,...) "BEGIN " << label << "\n"; \
3107 logObj.writeAsTextToBuffer(logObj.getLogManager()->getLogPrefixMask()); \
3108 LogMessageRecord::splitLongLogLine(logObj, __VA_ARGS__); \
3109 logObj << "END " << label
3120 template <
typename STREAM>
inline STREAM &
operator<<(STREAM& os,
const struct in_addr &addr)
3126 result = inet_ntop(AF_INET, &addr,
buffer,
sizeof(
buffer));
3132 result = InetNtop(AF_INET,
const_cast<struct in_addr *
>(&addr),
buffer,
sizeof(
buffer));
3134 if (result ==
nullptr) {
3135 result =
"[badipv4]";
3141 template <
typename STREAM>
inline STREAM &
operator<<(STREAM& os,
const struct in6_addr &addr)
3147 result = inet_ntop(AF_INET6, &addr,
buffer,
sizeof(
buffer));
3153 result = InetNtop(AF_INET6,
const_cast<struct in6_addr *
>(&addr),
buffer,
sizeof(
buffer));
3155 if (result ==
nullptr) {
3156 result =
"[badipv6]";
3162 template <
typename STREAM>
inline STREAM &
operator<<(STREAM& os,
const struct sockaddr_in &
s)
3171 template <
typename STREAM>
inline STREAM &
operator<<(STREAM& os,
const struct sockaddr_in6 &
s)
3176 os <<
ntohs(
s.sin6_port);
3181 template <
typename STREAM>
inline STREAM &
operator<<(STREAM& os,
const struct sockaddr_un &
s)
3189 template <
typename STREAM>
inline STREAM &
operator<<(STREAM& os,
const struct sockaddr &
s)
3191 switch (
s.sa_family) {
3193 const struct sockaddr_in *ipv4 =
reinterpret_cast<const struct sockaddr_in *
>(&
s);
3198 const struct sockaddr_in6 *ipv6 =
reinterpret_cast<const struct sockaddr_in6 *
>(&
s);
3204 const struct sockaddr_un *u =
reinterpret_cast<const struct sockaddr_un *
>(&
s);
3210 os <<
"[UnknownAF: " <<
s.sa_family <<
"]";
3222 #define _OUTPUT_MEMBER_FIELD(s,f) << " " #f "=" << (s). ## f
3231 #define _OUTPUT_MEMBER_FIELD_AS_STRING_BLOCK(s,f,l) << " " #f "=\"" << AS_ESCAPED_TEXT_BUFFER((s). ## f, l) << "\""
3240 #define _OUTPUT_MEMBER_FIELD_AS_STRING(s,f) _OUTPUT_MEMBER_FIELD_AS_STRING_BLOCK(s,f,strlen((s). ## f))
EscapedTextBlock_struct(const char justThisChar, const char *quoteTheseChars, const char *escapeUsing=_DEFAULT_REPLACEMENT_CHARACTERS, const char *convertNULL=_DEFAULT_NULL_REPLACEMENT) OME_ALWAYS_INLINE
Escape a single character.
Definition: logging_api.hpp:490
@ LOG_ARG_TYPE_INT32
Definition: logging_api.hpp:1096
@ PROCESS_THREAD
Definition: io_processor.hpp:160
#define _STDERR_FD
Platform-independent reference to standard error.
Definition: logging_api.hpp:2617
unsigned char uc
Definition: logging_api.hpp:1080
static int initializeLogSubsystem(int *newArgc, const char **newArgv, const int argc, const char *argv[], const char *componentName=nullptr, LogMaskType_t *appMaskLocation=nullptr, const uint_fast32_t maxLines=128, const LogMaskPrimitiveType_t logPrefixMask=~0U)
Initialize logging-specific parameters by passing command line arguments.
Definition: logging_api.cpp:700
SMV_StandaloneNumeric< uint32_t > packetsProcessed
Definition: io_processor.hpp:127
int_fast32_t text2int32(const char *textString, uint_fast8_t text_len) NONNULL_PARAMETERS(1) OME_ALWAYS_OPTIMIZE("-O3")
Convert a sequence of text characters into a 32-bit signed integer as quickly as possible....
Definition: text2int.h:135
uint_fast32_t bfrLen
Definition: logging_api.hpp:520
#define _ADD_NEW_LOG_ARG(typeEnum, member)
Definition: logging_api.hpp:1497
TimePointCache TimePointCacheForToday
Cached TimePoint information representing today.
IO_Processor_Statistics * statistics
statistics
Definition: io_processor.hpp:195
Ïúíþ ð Ø ˜ ˜ __text __TEXT € __apple_names __DWARF __apple_objc __DWARF __apple_namespac__DWARF H X __apple_types __DWARF l
Definition: tmp3.o.cpp:1
static uint16_t filePrefixLen[MAX_FILE_PREFIX_ENTRIES]
Definition: logging_api.hpp:582
SMV_StandaloneNumeric< uint32_t > coalesceCount("coalesceIOVEC")
IO_Processor * get_IO_Manager() const OME_ALWAYS_INLINE
Provide access to underlying IO_Processor.
Definition: logging_api.hpp:787
uint32_t u32
Definition: logging_api.hpp:150
Intermediary I/O processing object for performing multi-threaded receive-and-process operations on a ...
Definition: io_processor.hpp:154
uint32_t maxPendingLogLines
Definition: logging_api.hpp:118
uint32_t processID
Definition: logging_api.hpp:117
Intercept output to an existing file descriptor by taking ownership of its destination,...
Definition: logging_api.hpp:2177
@ LOG_ERROR_LEVEL
Include level indicator (INFO, ERROR, etc.)
Definition: logging_api.hpp:1042
IO_Processor * ioMgr
Definition: logging_api.hpp:598
uint_fast32_t logPrefixMask
Definition: logging_api.hpp:601
@ LOG_ARG_TYPE_POSIX_NANOSECONDS
Definition: logging_api.hpp:1110
BufferRegion * bfrMgr
Definition: logging_api.hpp:597
int closeLog()
Close the open log file.
Definition: logging_api.cpp:1153
@ LOG_SEVERITY_WARN
Definition: logging_api.hpp:1067
uint32_t defaultLogPrefix
Definition: logging_api.hpp:120
const char s[]
Definition: t.cpp:4
unsigned char currentThreadState
Definition: io_processor.hpp:217
FARGOS I/O Processing classes.
static const char * stripFilePrefix2[MAX_FILE_PREFIX_ENTRIES]
Definition: logging_api.hpp:585
@ MAX_FILE_PREFIX_ENTRIES
table size for maximum distinct directory prefixes
Definition: logging_api.hpp:575
size_t blockSize
Definition: logging_api.hpp:600
@ NOT_OWNER
indicates region is not owned by this BufferRegion
Definition: circular_bfr.hpp:180
static void defaultGetTime(struct timespec *timestamp, const LogManager *logMgr)
Definition: logging_api.hpp:556
#define stdout
Definition: tmp.o.cpp:3117
const char * textBfr
Definition: logging_api.hpp:218
Allocation record for chains in a 32-bit shared memory buffer.
Definition: circular_bfr.hpp:103
void * getExtraData() const OME_ALWAYS_INLINE
Retrieve extra information value.
Definition: io_processor.hpp:334
virtual unsigned char * blockAddress(const SharedBufferAllocRecord *record)
Definition: circular_bfr.hpp:282
int64_t i64
Definition: logging_api.hpp:1083
LogMessageRecord & operator<<(LogMessageRecord &logRec, const POSIXtimeInNanoseconds arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
Output a POSIXtimeInNanoseconds into a LogMessageRecord.
Definition: logging_api.hpp:1828
static void initializePrefixTable()
Initializes the file name prefix tables.
Definition: logging_api.cpp:329
#define DEBUG
Definition: OMEmutex.cpp:19
char * formatIntoString(char *bfr, uint_fast8_t bfrLen, uint_fast8_t *resultLen=nullptr, uint_fast8_t fieldsWanted=OUTPUT_DATE|OUTPUT_TIME, const char *fieldSeparators="/:. ") const
Format into text string.
Definition: time_point.hpp:1273
size_t writeAsTextToBuffer(unsigned int prefixWithFlags) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
Format the LogMessageRecord as a text output line (using formatRecordAsText()) and pass the resulting...
Definition: logging_api.hpp:1415
int32_t i32
Definition: logging_api.hpp:1081
uint32_t LogArgumentLenType_t
Typedef for length of field to store argument length.
Definition: logging_api.hpp:1120
#define _ADD_NEW_LOG_ARG_WITH_VALUE_AND_LEN(typeEnum, member, val, len)
Definition: logging_api.hpp:1504
uint32_t stripLeadingDirectories
Definition: logging_api.hpp:602
@ SMV_TYPE_INT64
Definition: shared_variable.hpp:49
EscapedTextBlock_struct(const std::string &bfr, const Escaped_Replacement_Characters &useReplacements=defaultEscapePatterns) OME_ALWAYS_INLINE
Escape std::string.
Definition: logging_api.hpp:478
@ LOG_ARG_TYPE_CHAR
Definition: logging_api.hpp:1103
const char byteAsLowercaseHexadecimal[256][3]
Table of uppercase hexadecimal characters for each byte value.
Definition: text2int.cpp:38
Convenience template for creating shared memory variables of one of the supported numeric types....
Definition: shared_variable.hpp:436
@ LOG_LINE_BINARY_FORMAT_BE
Indicates big-endian, IEEE 754 floating point format.
Definition: logging_api.hpp:195
static void splitLongLogLine(LogMessageRecord &context, const char *line, const char *separators=",;", size_t blockLength=LogManager::MAX_LOG_LINE_LENGTH)
Split the content of a null-terminate string across multiple log lines, breaking the lines at appropr...
Definition: logging_api.cpp:2055
uint_fast32_t getLogPrefixMask() const OME_ALWAYS_INLINE
Get current log prefix mask. It will be a combination of bits composed from LogMessageRecord::LogPref...
Definition: logging_api.hpp:647
const struct StringInROM_struct * StringInROM
Typedef to mark string data in text segment.
Definition: logging_api.hpp:206
virtual ~LogManager()
Definition: logging_api.cpp:1116
TimeAcquisitionFP getTimestampRoutine
Definition: logging_api.hpp:605
TextBlock_struct(const char *bfr) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
Definition: logging_api.hpp:225
@ SMV_TYPE_DOUBLE
Definition: shared_variable.hpp:52
#define stderr
Definition: tmp.o.cpp:3115
const void * dataBfr
Definition: logging_api.hpp:534
unsigned char * bufferAddress(SharedBufferAllocRecord *rec, size_t *bufferLen=nullptr) const OME_ALWAYS_INLINE
Return physical address of a buffer within the context of the local process' address space.
Definition: io_processor.hpp:275
char escapedChar[256][MAX_REPLACEMENT_LENGTH+1]
Definition: logging_api.hpp:275
EscapedTextBlock_struct(const char *bfr, const Escaped_Replacement_Characters &useReplacements=defaultEscapePatterns) OME_ALWAYS_INLINE
Escape string, determine string length.
Definition: logging_api.hpp:426
@ LOG_SEVERITY_DEBUG
Definition: logging_api.hpp:1065
const TextBlock_struct pruneDirectoryPrefix(const char *fileName, const int_fast32_t fileNameLen)
Return the source file name pruned of any leading directory components as indicated by settings impos...
Definition: logging_api.cpp:1040
@ LOG_ARG_TYPE_TEXT_FRAGMENT
Definition: logging_api.hpp:1107
Union to hold arbitrary argument value.
Definition: logging_api.hpp:1077
@ OWN_BLOCK
indicates region is owned by the BufferRegion and should be recovered when deleted.
Definition: circular_bfr.hpp:181
static const char * getSeverityLabel(uint_fast32_t level)
Definition: logging_api.cpp:432
Cache locale-specific time data around a particular point in time.
Definition: time_point.hpp:92
Convenience mechanism to automatically register a log component.
Definition: logging_api.hpp:1002
ReplumbAndLog(OS_HANDLE_TYPE existing_fd, IO_processBlockFP rout=acceptData, const char *label="replumb")
Definition: logging_api.cpp:2160
uint32_t _explicitAlignmentPaddding
Definition: logging_api.hpp:603
@ LOG_LINE_BINARY_FORMAT_BE_S360
Indicates big-endian, IBM System/360 hexadecimal floating point.
Definition: logging_api.hpp:197
@ LOG_SEVERITY_TRACE
Definition: logging_api.hpp:1064
SMV_StandaloneNumeric< uint64_t > bytesProcessed
Definition: io_processor.hpp:123
static LogManager * DEFAULT_LogManager
Default log manager used, set by newStandardLogFile()
Definition: logging_api.hpp:616
uint32_t sourceLine
Line in source file, usually from LINE
Definition: logging_api.hpp:1129
Holds collected statistics for an IO_Processor object.
Definition: io_processor.hpp:118
const char * textBfr
points at text to be processed
Definition: logging_api.hpp:379
uint32_t defaultLogLevel
Definition: logging_api.hpp:119
Intermediate naming node for supporting variable naming hierarchies.
Definition: shared_variable.hpp:318
SMV_StandaloneNumeric< uint64_t > bytesRead
Definition: io_processor.hpp:122
BufferRegion * getBufferManager() const OME_ALWAYS_INLINE
Provide access to the underlying BufferRegion.
Definition: logging_api.hpp:781
#define OME_ALWAYS_OPTIMIZE(level)
Mark a function to be compiled with a specific level of optimization.
Definition: compiler_hints.h:406
int64_t i64
Definition: logging_api.hpp:151
Definition: logging_api.hpp:147
void setLogFormat(const char *f) OME_ALWAYS_INLINE
Set arbitrary log line format text.
Definition: logging_api.hpp:1260
~ReplumbAndLog()
Definition: logging_api.hpp:2190
uint32_t cachedFileNameCount
Definition: logging_api.hpp:604
LogMaskType_t COMPONENT_LOG_MASK() io("io_logMask", &DEFAULT_sharedMemoryVariableManager, COMPONENT_LEVEL(io, warn)|COMPONENT_LEVEL(io, error)|COMPONENT_LEVEL(io, fatal))
#define _INVALID_DESCRIPTOR
Platform-independent reference to invalid descriptor.
Definition: logging_api.hpp:2618
void setStripLeadingDirectories(uint_fast32_t dirCount)
Definition: logging_api.hpp:674
uint32_t getThreadMode() const OME_ALWAYS_INLINE
Get requested thread modes.
Definition: io_processor.hpp:364
uint32_t u32
Definition: logging_api.hpp:1082
static int define_commandline_flag(const char *flagName, LogMaskPrimitiveType_t mask, const char *label=nullptr)
Define a new log level name for the command line parser.
Definition: logging_api.cpp:590
const char * logLineFormat
Points format line for log line.
Definition: logging_api.hpp:1123
@ SMV_TYPE_STRING
Definition: shared_variable.hpp:56
#define INVALID_HANDLE_VALUE
Definition: logging_api.cpp:85
long buffer[MAXDLBUF]
Definition: ethers.c:42
@ LOG_ARG_TYPE_TEXT
Definition: logging_api.hpp:1102
#define _SET_LOGMGR_FOR(output)
Create log manager for STDOUT or STDERR.
Definition: logging_api.hpp:2736
#define OME_COLD_ROUTINE
Annotation macro to tell compiler a routine may never be used.
Definition: compiler_hints.h:370
TimePointCache logTimePointCache
Definition: logging_api.hpp:612
float f
Definition: logging_api.hpp:1085
LogManager(SharedMemoryVariableNode *parentNode, OS_HANDLE_TYPE output_fd, uint_fast8_t useSeparateThread, const char *appName, uint_fast32_t logLinePrefixMask=~0U, uint_fast32_t maxLineSize=(LogManager::MAX_LOG_LINE_LENGTH - sizeof(SharedBufferAllocRecord)), unsigned char *region=nullptr, size_t bytes=(LogManager::MAX_LOG_LINE_LENGTH *64))
Create anonymous buffer.
Definition: logging_api.cpp:958
@ LOG_FILENAME
Include source filename on logline.
Definition: logging_api.hpp:1040
Escaped_Replacement_Characters(const char *quoteTheseChars=_DEFAULT_ESCAPED_CHARACTERS, const char *escapeUsing=_DEFAULT_REPLACEMENT_CHARACTERS, const char *convertNULL=_DEFAULT_NULL_REPLACEMENT) OME_ALWAYS_INLINE
Constructor that dynamically prepares content.
Definition: logging_api.hpp:343
@ LOG_ARG_TYPE_INT64
Definition: logging_api.hpp:1098
@ MAX_REPLACEMENT_LENGTH
Definition: logging_api.hpp:273
#define ntohs(x)
Definition: tmp.o.cpp:3103
struct BitFlagAndName logFlagBits[MAX_DISTINCT_FLAG_ALIASES]
ThreadMode
Mask to select threading modes.
Definition: io_processor.hpp:157
SharedBufferAllocRecord * formatRecordAsText(unsigned int prefixWithFlags, size_t *returnLen=nullptr, uint32_t singleThreaded=false) OME_ALWAYS_OPTIMIZE("-O3")
Format LogMessageRecord into text, prefixing the line with the indicated attributes.
Definition: logging_api.cpp:1288
SharedBufferAllocRecord * allocateBuffer() OME_ALWAYS_INLINE
Allocate a buffer for a log record.
Definition: logging_api.hpp:847
float f
Definition: logging_api.hpp:153
OwnershipState
Definition: circular_bfr.hpp:179
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
ssize_t copyAndWriteData(const void *data, size_t len)
Write block of data to the log buffer.
Definition: logging_api.hpp:916
#define OME_PREFETCH(addr, rw, locality)
Macro to request prefetch.
Definition: compiler_hints.h:362
SharedMemoryVariableNode namingNode
Definition: logging_api.hpp:2182
void setReadAttempts(uint32_t count) OME_ALWAYS_INLINE
Set read attempts before blocking.
Definition: io_processor.hpp:309
static LogManager * STDOUT_LogManager
Created automatically.
Definition: logging_api.hpp:617
static LogManager * STDERR_LogManager
Created automatically.
Definition: logging_api.hpp:618
char * fixedpoint_to_ascii(char *resultBfr, uint_fast8_t bfrLen, int64_t value, uint_fast8_t precision, uint_fast8_t *retStrLen, int_fast8_t outputPrecision)
Format a fixed-point value with indicated decimal places.
Definition: text2int.cpp:2734
~AutoRegisterLogComponent()
Definition: logging_api.hpp:1014
unsigned char useThreads
Definition: logging_api.hpp:121
uint_fast32_t LogMaskPrimitiveType_t
Definition: logging_api.hpp:105
const char * getErrorCondition() const OME_ALWAYS_INLINE
Return error condition text detected. This is normally used to obtain an explanation of errors report...
Definition: logging_api.hpp:932
int setThreadMode(ThreadMode mode)
Set threading mode.
Definition: io_processor.cpp:564
@ LOG_BINARY_FORMAT_STRING
For binary output, include format string.
Definition: logging_api.hpp:1043
#define MAX_SUPPORTED_COMPONENTS
Definition: logging_api.cpp:167
@ SMV_TYPE_FLOAT
Definition: shared_variable.hpp:51
@ AND_USE_SYSLOG
Definition: logging_api.hpp:1071
uint32_t argCountExceeded
Definition: logging_api.hpp:1132
const char srcID[]
Definition: catSym.c:17
uint64_t u64
Definition: logging_api.hpp:1084
#define LOGFILE_BFR_MAGIC_NUMBER
Magic number for shared memory log file buffer.
Definition: logging_api.hpp:103
EscapedTextBlock_struct(const std::string &bfr, const char *quoteTheseChars, const char *escapeUsing=_DEFAULT_REPLACEMENT_CHARACTERS, const char *convertNULL=_DEFAULT_NULL_REPLACEMENT) OME_ALWAYS_INLINE
Escape std::string.
Definition: logging_api.hpp:464
void waitForBufferAllocRecordToBeReady(SharedBufferAllocRecord *rec)
Verify record is prepared and, if needed, wait until it is prepared.
Definition: circular_wait.hpp:16
double d
Definition: logging_api.hpp:1086
void setTimeAcquisitionRoutine(TimeAcquisitionFP routine)
Set alternate timestamp acquisition routine.
Definition: logging_api.hpp:947
uint64_t u64
Definition: logging_api.hpp:152
LogArgumentType argBaseType
Definition: logging_api.hpp:1137
Definition: logging_api.hpp:1135
#define ADD_IOV_ELEMENT(ptr, len, testCount)
Convenience macro to add element to iovec array.
Definition: logging_api.cpp:1278
static uint16_t filePrefix2Len[MAX_FILE_PREFIX_ENTRIES]
Definition: logging_api.hpp:583
union LogLineBinaryValue::LogLineBinaryValue_union value
static TextBlock_struct getSeverityLabelWithLength(uint_fast32_t level)
Get the text label for a logging level along with its length.
Definition: logging_api.cpp:403
const unsigned char * asUCstring
Definition: logging_api.hpp:1089
unsigned char * bufferAddress(SharedBufferAllocRecord *rec, size_t *bufferLen=nullptr) const OME_ALWAYS_INLINE
Obtain the physical address and length of a buffer from a SharedBufferAllocRecord,...
Definition: logging_api.hpp:871
@ READ_AND_PROCESS_ON_SAME_THREAD
a single spawned read thread will do both read-and-processing
Definition: io_processor.hpp:167
OS_HANDLE_TYPE descriptor
Definition: io_processor.hpp:210
bool isForDay(const time_t t) const OME_ALWAYS_INLINE
Definition: time_point.hpp:201
AutoRegisterLogLevelName(const char *name, uint32_t mask, const char *label=nullptr)
Automatically register a log level name with the command line option parser.
Definition: logging_api.hpp:2157
@ LOG_MAX_ARGUMENT_TOTAL
Maximum number of arguments for an output line.
Definition: logging_api.hpp:1030
Represents a single binary log element.
Definition: logging_api.hpp:145
LogLevelSeverityMask
Standard bit flags to define severity level. There is a partial order of implied importance here,...
Definition: logging_api.hpp:1062
SharedBufferAllocRecord * prepareBinaryRecord(unsigned int prefixWithFlags, size_t *returnLen=nullptr, uint32_t singleThreaded=false)
Assemble LogMesageRecord into a suitable PDU format.
Definition: logging_api.cpp:1869
void addCachedFileName(const char *fileNameKey, const TextBlock_struct entry)
Definition: logging_api.cpp:1031
const void * ptr
Definition: logging_api.hpp:1087
@ LOG_LINE_NUMBER
Include source line number on logline.
Definition: logging_api.hpp:1041
EscapedTextBlock_struct(const char *bfr, const char *quoteTheseChars, const char *escapeUsing=_DEFAULT_REPLACEMENT_CHARACTERS, const char *convertNULL=_DEFAULT_NULL_REPLACEMENT) OME_ALWAYS_INLINE
Escape string, determine string length.
Definition: logging_api.hpp:410
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
@ CONTIGUOUS_FILE_STREAM
contiguous byte stream from file
Definition: io_processor.hpp:185
BinaryBlock_struct(const void *bfr, uint_fast32_t len) OME_ALWAYS_INLINE
Definition: logging_api.hpp:522
Implements multi-threaded, deferred physical I/O log file manager.
Definition: logging_api.hpp:552
uint64_t convertToNanosecondsSinceEpoch() const OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
Convert a POSIXtimeInUnits to nanoseconds since the POSIX epoch.
Definition: time_point.hpp:471
static uint_fast32_t addLogComponent(const char *componentName, LogMaskType_t *maskLocation, LogMaskPrimitiveType_t initialMask=0)
Add definition of new log component.
Definition: logging_api.cpp:202
@ LOG_ARG_TYPE_FLOAT
Definition: logging_api.hpp:1100
HexadecimalBlock_struct(const void *bfr, uint_fast32_t len, bool useLowercase=true) OME_ALWAYS_INLINE
Definition: logging_api.hpp:538
#define OME_EXPECT_TRUE(expr)
Annotation macro for conditional expression expected to be true.
Definition: compiler_hints.h:541
char stringData[1]
Definition: logging_api.hpp:202
int waitForThreadExit(uint32_t modes)
Wait for threads to terminate.
Definition: io_processor.cpp:728
SMV_StandaloneNumeric< uint32_t > packetsRead
Definition: io_processor.hpp:125
#define OME_INIT_PRIORITY(n)
Override initialization priority of a C++ variable.
Definition: compiler_hints.h:372
virtual SharedBufferAllocRecord * allocateBlock(size_t len)=0
#define _DEFAULT_NULL_REPLACEMENT
Default replacement for null character by EscapedTextBlock_struct.
Definition: logging_api.hpp:259
Representation of localized expanded UNITS-since-epoch.
Definition: time_point.hpp:596
AutoRegisterLogComponent(LogMaskType_t &var, const char *name=nullptr, LogMaskPrimitiveType_t defaultMask=0)
Definition: logging_api.hpp:1004
int stopThread(uint32_t modes)
Request stop.
Definition: io_processor.cpp:684
const char * sourceFile
Points to source file, usually from FILE
Definition: logging_api.hpp:1124
virtual void returnBlock(SharedBufferAllocRecord *record)=0
Placeholder structure to reference a block of arbitrary data.
Definition: logging_api.hpp:517
Representation of UNITS-since-POSIX-epoch. This is an unambiguous time reference; there is no locale-...
Definition: time_point.hpp:313
LogMessageRecord(LogManager *mgr, uint32_t importanceFlags, const char *atFileName, uint32_t atLineNumber, int_fast32_t fileNameLen=-1) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
Definition: logging_api.hpp:1210
static LogManager * newLogToFileDescriptor(SharedMemoryVariableNode *parentNode, OS_HANDLE_TYPE fd, LogMaskPrimitiveType_t logPrefixMask, uint_fast8_t useSeparateThreads, unsigned char *region, size_t bytes)
Definition: logging_api.cpp:842
LogPrefixMask
Log line prefix attributes.
Definition: logging_api.hpp:1036
@ PROCESS_DURING_READ
Processing will be performed by the read thread.
Definition: io_processor.hpp:162
uint32_t sourceFileNameLen
Length of sourceFile path.
Definition: logging_api.hpp:1127
Extreme-performance text/number conversion routines.
LogManager * logMgr
Definition: logging_api.hpp:2181
EscapedTextBlock_struct(const char *bfr, uint_fast32_t len, const Escaped_Replacement_Characters &useReplacements=defaultEscapePatterns) OME_ALWAYS_INLINE
Escape string of known length with precomputed escapes.
Definition: logging_api.hpp:452
uint_fast32_t bfrLen
Definition: logging_api.hpp:535
#define NULL
Definition: tmp.o.cpp:327
const char * asCstring
Definition: logging_api.hpp:1088
EscapedTextBlock_struct(const char justThisChar, const Escaped_Replacement_Characters &useReplacements=defaultEscapePatterns) OME_ALWAYS_INLINE
Definition: logging_api.hpp:502
LogMaskType_t COMPONENT_LOG_MASK() app("app_logMask", &DEFAULT_sharedMemoryVariableManager, COMPONENT_LEVEL(app, defaultMask))
int submitOrProcessBlock(SharedBufferAllocRecord *rec)
Submission routine that will either directly invoke the processing routine or notify the processing t...
Definition: io_processor.cpp:144
Escaped_Replacement_Characters dynamicReplacements
storage for dynamically assigned replacements
Definition: logging_api.hpp:383
char asChars[8]
Definition: logging_api.hpp:148
static int commitLogRecord(SharedBufferAllocRecord *rec, IO_Processor *controller)
IO_processor-compatible process routine used to write buffered data to an open file.
Definition: logging_api.cpp:1173
bool asLowercase
Definition: logging_api.hpp:536
char * float_to_ascii(char *resultBfr, uint_fast8_t bfrLen, double value, uint_fast8_t *retStrLen, int_fast8_t outputPrecision, bool roundValue)
Format a double-precision value with indicated decimal places.
Definition: text2int.cpp:2808
@ LOG_SEVERITY_ERROR
Definition: logging_api.hpp:1068
Log message record used to remember output format and argument values, potentially deferring formatti...
Definition: logging_api.hpp:1022
char singleOutputChar
storage for single character
Definition: logging_api.hpp:381
TextBlock_struct(const char *bfr, uint_fast32_t len, bool clipAtNull=false) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
Definition: logging_api.hpp:241
#define COMPONENT_LOG_MASK(component)
Construct variable name for a component's active log mask.
Definition: logging_api.hpp:2214
char logFileName[256]
Definition: logging_api.hpp:614
uint_fast32_t bfrLen
specifies length of text string
Definition: logging_api.hpp:380
const char * errorCondition
Definition: logging_api.hpp:599
const char * fileName
Definition: logging_api.hpp:563
const void * dataBfr
Definition: logging_api.hpp:519
@ LOG_ARG_TYPE_BINARY
Definition: logging_api.hpp:1104
struct timespec timestamp
Timestamp of log event creation.
Definition: logging_api.hpp:1125
@ SMV_TYPE_INT32
Definition: shared_variable.hpp:47
#define __cplusplus
Definition: tmp.o.cpp:2998
Placeholder structure to reference a block of arbitrary data to be output in hexadecimal.
Definition: logging_api.hpp:532
char * int_to_ascii(uint32_t resultBfr[], uint_fast8_t bfrLen, int64_t value, uint_fast8_t *retStrLen)
Identical to uint_to_ascii(), except that negative values are accepted.
Definition: text2int.cpp:2699
void setErrorCondition(const char *messageText) OME_ALWAYS_INLINE
Set error condition text.
Definition: logging_api.hpp:938
void returnBuffer(SharedBufferAllocRecord *rec) OME_ALWAYS_INLINE
Return a buffer previously allocated by allocateBuffer().
Definition: logging_api.hpp:857
@ NONE
No threads will be spawned.
Definition: io_processor.hpp:158
void initEscapes(const char *quoteTheseChars, const char *escapeUsing, const char *convertNULL) OME_ALWAYS_INLINE
Initialize escape table.
Definition: logging_api.hpp:289
@ LOG_ARG_TYPE_UINT32
Definition: logging_api.hpp:1097
FARGOS Shared Memory Variable routines.
@ MIN_IOV_UNIT_LEN
Minimum amount of string bytes worth an iovec entry.
Definition: logging_api.hpp:1032
Structure defined to generate unique type name.
Definition: logging_api.hpp:201
const char srcID[] OME_USED
Definition: tick_time.cpp:24
TimePointCacheTable argTimeCacheTable
Definition: logging_api.hpp:613
int flags
Definition: ethers.c:41
uint_fast32_t setLogPrefixMask(uint_fast32_t newMask) OME_ALWAYS_INLINE
Set the log prefix mask. The new mask is defined as a combination of bits created by OR'ing together ...
Definition: logging_api.hpp:663
@ LOG_THREAD_ID
Include thread id on logline.
Definition: logging_api.hpp:1039
Structure to hold table of characters that should be replaced or deleted.
Definition: logging_api.hpp:271
@ AND_SPECIAL_MASK
Definition: logging_api.hpp:1073
unsigned char bfrBlock[0x2000]
Definition: logging_api.hpp:2183
const TimePointCache & getCacheEntry(time_t t)
Returns a TimePointCache entry for the day indicated by the number of seconds since the POSIX epoch.
Definition: time_point.hpp:292
FileNameCacheEntry fileNameReplacementCache[FILENAME_CACHE_SIZE]
Definition: logging_api.hpp:606
@ LOG_TIMESTAMP
Include time on logline.
Definition: logging_api.hpp:1038
int interpolated_clock_gettime(struct timespec *result, bool force)
Get time with nanosecond precision using interpolation of elapsed CPU ticks.
Definition: tick_time.cpp:315
OS_HANDLE_TYPE output_fd
Definition: logging_api.hpp:2180
@ LOG_SEVERITY_FATAL
Definition: logging_api.hpp:1069
static LogManager * newLogFileForComponent(SharedMemoryVariableNode *parentNode, const char *app, uint_fast32_t filenameCreateFlags, LogMaskPrimitiveType_t logPrefixMask, uint_fast8_t enableMap, uint_fast8_t useSeparateThreads, size_t desiredRegionSize=0, size_t reserveAtEnd=0, const char *inDir=getenv(DEFAULT_LOG_DIRECTORY_ENVIRONMENT_VARIABLE))
Create a new file and LogManager for a component. If desired, also create an auxilary backing file fo...
Definition: logging_api.cpp:856
Placeholder structure to reference a text fragment that will have selected characters transformed or ...
Definition: logging_api.hpp:368
Class to maintain fileName->shortened replacement record.
Definition: logging_api.hpp:561
void emitOverflowError(const T &arg) OME_COLD_ROUTINE
Called when too many arguments are output.
Definition: logging_api.hpp:1487
LOG_argument_union logArgs
Definition: logging_api.hpp:1136
#define __EXPLICIT_LOG_MESSAGE_BODY
Allow message to be built up using the << operator.
Definition: logging_api.hpp:1806
uint_fast32_t bfrLen
Definition: logging_api.hpp:219
void getTimestamp(struct timespec *timestamp) const OME_ALWAYS_INLINE
Return the current time using the timestamp acquisition routine associated with the log.
Definition: logging_api.hpp:967
TimeAcquisitionFP getTimeAcquisitionRoutine() const OME_ALWAYS_INLINE
Return pointer to the time acquistion routine associated with the log.
Definition: logging_api.hpp:958
Impose a circular buffer on a BufferRegion.
Definition: circular_bfr.hpp:330
void addLogArg(LogMessageRecord &logRec, const int32_t arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
Add log argument of indicated type.
Definition: logging_api.hpp:1541
int errno
Definition: ethers.c:41
unsigned char enableMap
Definition: logging_api.hpp:122
#define LOG_ERR
Definition: getether.c:23
size_t writeAsBinaryToBuffer(unsigned int prefixWithFlags)
Format the LogMessageRecord as a binary record (using prepareBinaryRecord()) and pass the resulting b...
Definition: logging_api.hpp:1466
Compiler-specific macros to provide performance-related hints.
int generateFormatString(unsigned int fieldNum) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3")
Append appropriate format parameters for previously added argument.
Definition: logging_api.hpp:1273
#define OME_EXPECT_FALSE(expr)
Annotation macro for conditional expression expected to be false.
Definition: compiler_hints.h:540
static LogManager * newStandardLogFile(const char *namedComponent=nullptr, LogMaskPrimitiveType_t filenameCreateFlags=~0U, SharedMemoryVariableNode *parentNode=nullptr)
High-level routine to create a standard log file associated with a component.
Definition: logging_api.cpp:935
@ LOG_SEVERITY_USER
Definition: logging_api.hpp:1070
uint32_t usedLen
Definition: circular_bfr.hpp:107
int8_t escapedLen[256]
Definition: logging_api.hpp:274
#define OME_ALWAYS_INLINE
Tell the compiler to alway inline a function, regardless of optimization level.
Definition: compiler_hints.h:364
SMV_StandaloneNumeric< LogMaskPrimitiveType_t > LogMaskType_t
Definition: logging_api.hpp:106
double d
Definition: logging_api.hpp:154
uint32_t blockLen
Definition: circular_bfr.hpp:106
#define _DEFAULT_REPLACEMENT_CHARACTERS
Default replacement characters for EscapedTextBlock_struct.
Definition: logging_api.hpp:257
@ SMV_TYPE_UINT32
Definition: shared_variable.hpp:48
#define _STDOUT_FD
Platform-independent reference to standard out.
Definition: logging_api.hpp:2616
Descriptive meta-data for log file-related information.
Definition: logging_api.hpp:110
int32_t i32
Definition: logging_api.hpp:149
@ SMV_TYPE_TINY_BINARY_STRING
Definition: shared_variable.hpp:55
unsigned char bytes[sizeof(char *)]
Definition: logging_api.hpp:1079
int waitForThreadStart(uint32_t mode)
Wait for threads to start.
Definition: io_processor.cpp:712
void(* TimeAcquisitionFP)(struct timespec *, const LogManager *)
Definition: logging_api.hpp:554
#define MAX_ELEMENT_TOTAL
Maximum possible iovec elements, usually leading text and the argument data.
Definition: logging_api.cpp:1268
IO_processBlockFP processBlockRoutine
Definition: io_processor.hpp:199
struct LogLineBinaryValueHeader hdr
Definition: logging_api.hpp:146
void setOwnership(OwnershipState newOwnership)
Change administrative ownership of region.
Definition: circular_bfr.hpp:232
LogManager * logMgr
Points to LogManager used for output.
Definition: logging_api.hpp:1122
uint_fast32_t makeQualifiedFileName(char *fileName, uint_fast32_t fileNameLen, const char *componentName, const char *suffix, const char *dirName, uint_fast32_t flags)
Create a filename and optionally qualify with the current date and process Id.
Definition: mapped_file.cpp:98
const char * programName
Definition: logging_api.hpp:116
static int acceptData(SharedBufferAllocRecord *rec, IO_Processor *controller)
Definition: logging_api.cpp:2123
@ LOG_DATESTAMP
Include date on logline.
Definition: logging_api.hpp:1037
@ LOG_ARG_TYPE_HEX_FRAGMENT_UPPER
Definition: logging_api.hpp:1109
uint32_t argCount
Number of arguments for log line.
Definition: logging_api.hpp:1128
char asChars[sizeof(char *)]
Definition: logging_api.hpp:1078
Escaped_Replacement_Characters(bool doNothing)
Constructor that does no preparation.
Definition: logging_api.hpp:333
ssize_t writeDataToBuffer(SharedBufferAllocRecord *rec)
Low-level routine to add a record to log buffer.
Definition: logging_api.cpp:1128
OS_HANDLE_TYPE source_fd
Definition: logging_api.hpp:2179
@ FILENAME_CACHE_SIZE
max entries in prune filename cache
Definition: logging_api.hpp:577
SharedBufferAllocRecord_32 SharedBufferAllocRecord
Default SharedBufferAllocRecord.
Definition: circular_bfr.hpp:133
#define OS_HANDLE_TYPE
Definition: io_processor.hpp:48
static void setSourceForCustomLogTime(POSIXtimeInNanoseconds *timeSource)
Convenience routine to set location of a custom time value for log lines.
Definition: logging_api.cpp:189
@ LOG_ARG_TYPE_HEX_FRAGMENT
Definition: logging_api.hpp:1108
const char byteAsUppercaseHexadecimal[256][3]
Table of uppercase hexadecimal characters for each byte value.
Definition: text2int.cpp:78
LogArgumentLenType_t argLen
Definition: logging_api.hpp:1138
Interface to a buffer region. This is an abstract class.
Definition: circular_bfr.hpp:177
ssize_t copyAndWriteDataToBuffer(SharedBufferAllocRecord *rec, const void *data, size_t len)
Low-level routine to copy data and add a record to log buffer.
Definition: logging_api.cpp:1138
TextBlock_struct replacementText
Definition: logging_api.hpp:564
@ LOG_SEVERITY_INFO
Definition: logging_api.hpp:1066
@ LOG_ARG_TYPE_POINTER
Definition: logging_api.hpp:1105
~LogMessageRecord()
Definition: logging_api.hpp:1242
char * uint_to_ascii(uint32_t resultBfr[], uint_fast8_t bfrLen, uint64_t value, uint_fast8_t *retStrLen)
Quickly convert a binary integer into ASCII decimal text.
Definition: text2int.cpp:2628
struct LogMessageRecord::ArgumentRecord argList[LOG_MAX_ARGUMENT_TOTAL]
@ LOG_ARG_TYPE_DOUBLE
Definition: logging_api.hpp:1101
uint32_t generatedOffset
End of log line generated via << operator.
Definition: logging_api.hpp:1131
size_t zeroFileContents(int descriptor, size_t fileLength)
Write out zero-filled blocks to a file.
Definition: mapped_file.cpp:178
#define DEFAULT_LOG_DIRECTORY_ENVIRONMENT_VARIABLE
Definition: logging_api.hpp:100
@ SMV_TYPE_UINT64
Definition: shared_variable.hpp:50
EscapedTextBlock_struct(const char *bfr, uint_fast32_t len, const char *quoteTheseChars, const char *escapeUsing=_DEFAULT_REPLACEMENT_CHARACTERS, const char *convertNULL=_DEFAULT_NULL_REPLACEMENT) OME_ALWAYS_INLINE
Escape string of known length.
Definition: logging_api.hpp:438
~AutoRegisterLogLevelName()
Definition: logging_api.hpp:2163
@ LOG_LINE_BINARY_FORMAT_VER1
Denotes version of 1 of the header format.
Definition: logging_api.hpp:191
Convenience mechanism to automatically register a log level command line flag definition.
Definition: logging_api.hpp:2144
#define MAX_DISTINCT_FLAG_ALIASES
Definition: logging_api.cpp:268
static int process_commandline_log_flags(LogSubsystemInfo *info, int argc, const char *argv[], int *newArgc, const char **newArgv)
Process the standard argument list provided to an application and strip out the logging-related optio...
Definition: logging_api.cpp:637
void killProcessingThread()
Definition: logging_api.hpp:626
#define _DEFAULT_ESCAPED_CHARACTERS
Default set of characters to be escaped by EscapedTextBlock_struct.
Definition: logging_api.hpp:255
static void returnCustomLogTime(struct timespec *timestamp, const LogManager *logMgr)
Convenience routine to retrieve a custom timestamp for log lines.
Definition: logging_api.cpp:194
#define IOV_MAX
Definition: tmp.o.cpp:268
@ LOG_ARG_TYPE_FIXED_POINT
Definition: logging_api.hpp:1111
@ LOG_ARG_TYPE_ROM_TEXT
Definition: logging_api.hpp:1106
LogArgumentType
Argument type indicators, reuses those from the SharedMemoryVariables.
Definition: logging_api.hpp:1095
LogManager * getLogManager() const OME_ALWAYS_INLINE
Definition: logging_api.hpp:1244
@ SMV_TYPE_TINY_STRING
Definition: shared_variable.hpp:54
Placeholder structure to reference a text fragment.
Definition: logging_api.hpp:216
static Escaped_Replacement_Characters defaultEscapePatterns
Pre-generated default escape patterns.
Definition: logging_api.hpp:371
uint32_t importanceLevel
Value from LogLevelSeverityMask enum.
Definition: logging_api.hpp:1130
const Escaped_Replacement_Characters * replacementsToUse
effective replacement characters
Definition: logging_api.hpp:382
Convenience class to maintain a table of TimePointCache objects.
Definition: time_point.hpp:269
unsigned char bytes[8]
Definition: logging_api.hpp:155
int fd
Definition: ethers.c:41
@ LOG_ARG_TYPE_UINT64
Definition: logging_api.hpp:1099
FileNameCacheEntry findCachedFileName(const char *fileName) const
Definition: logging_api.cpp:1018
#define DEFINE_COMPONENT_LOG_MASKS(component)
Define default symbolic log mask names for a component.
Definition: logging_api.hpp:2444
FileNameCacheEntry()
Null constructor for cache entry.
Definition: logging_api.hpp:567
@ LOG_LINE_BINARY_FORMAT_LE
Indicates little-endian, IEEE 754 floating point format.
Definition: logging_api.hpp:193
struct LogSubsystemInfo default_LogSubsystemInfo
Default descriptive information for Logging subsystem.
Definition: logging_api.cpp:117
uint64_t threadId
Thread Id of log event creator.
Definition: logging_api.hpp:1126
@ AND_USE_STDERR
Definition: logging_api.hpp:1072
@ MAX_LOG_LINE_LENGTH
Default maximum length of a log line.
Definition: logging_api.hpp:610
static const char * stripFilePrefix[MAX_FILE_PREFIX_ENTRIES]
Definition: logging_api.hpp:584
int(* IO_processBlockFP)(SharedBufferAllocRecord *rec, class IO_Processor *controller)
Process a block of data received from an input source.
Definition: io_processor.hpp:69
#define EINTR
Definition: tmp.o.cpp:93