FARGOS/VISTA Object Management Environment Core
..
|
FARGOS Logging API. More...
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <utils/base/compiler_hints.h>
#include <stdint.h>
#include <memory.h>
#include <utils/base/circular_bfr.hpp>
#include <utils/io/io_processor.hpp>
#include <utils/shared_vars/shared_variable.hpp>
#include <utils/time/time_point.hpp>
#include <iostream>
Go to the source code of this file.
Classes | |
struct | LogSubsystemInfo |
Descriptive meta-data for log file-related information. More... | |
struct | LogLineBinaryValueHeader |
Header record for a binary output log line. More... | |
struct | LogLineBinaryValue |
Represents a single binary log element. More... | |
union | LogLineBinaryValue::LogLineBinaryValue_union |
struct | LogLineBinaryHeader |
Header for encoded log line template and arguments. More... | |
struct | StringInROM_struct |
Structure defined to generate unique type name. More... | |
class | TextBlock_struct |
Placeholder structure to reference a text fragment. More... | |
class | Escaped_Replacement_Characters |
Structure to hold table of characters that should be replaced or deleted. More... | |
class | EscapedTextBlock_struct |
Placeholder structure to reference a text fragment that will have selected characters transformed or deleted. More... | |
class | BinaryBlock_struct |
Placeholder structure to reference a block of arbitrary data. More... | |
class | HexadecimalBlock_struct |
Placeholder structure to reference a block of arbitrary data to be output in hexadecimal. More... | |
class | LogManager |
Implements multi-threaded, deferred physical I/O log file manager. More... | |
class | LogManager::FileNameCacheEntry |
Class to maintain fileName->shortened replacement record. More... | |
class | AutoRegisterLogComponent |
Convenience mechanism to automatically register a log component. More... | |
class | LogMessageRecord |
Log message record used to remember output format and argument values, potentially deferring formatting to a later point in time or by an external process. More... | |
union | LogMessageRecord::LOG_argument_union |
Union to hold arbitrary argument value. More... | |
struct | LogMessageRecord::ArgumentRecord |
class | AutoRegisterLogLevelName |
Convenience mechanism to automatically register a log level command line flag definition. More... | |
class | ReplumbAndLog |
Intercept output to an existing file descriptor by taking ownership of its destination, examining all data written to that descriptor, and possibly modifying it before sending it on to the originally intended output destination. More... | |
Macros | |
#define | USE_GETTID_FOR_THREADID 0 |
Permits use of gettid() rather than pthread_self() for thread Id on Linux. More... | |
#define | COMPILE_DEBUG_LEVEL ~0 |
#define | DEFAULT_LOG_DIRECTORY_ENVIRONMENT_VARIABLE "LOGDIR" |
#define | LOGFILE_BFR_MAGIC_NUMBER "LOGCBFR" |
Magic number for shared memory log file buffer. More... | |
#define | SiR(x) ((StringInROM) (x)) |
Very short macro to encapsulate content intended to be flagged as "permanent" String-in-ROM text. More... | |
#define | _DEFAULT_ESCAPED_CHARACTERS "\"\n\r\t\b\\" |
Default set of characters to be escaped by EscapedTextBlock_struct. More... | |
#define | _DEFAULT_REPLACEMENT_CHARACTERS "\\\"\0\\n\0\\r\0\\t\0\\b\0\\\\\0" |
Default replacement characters for EscapedTextBlock_struct. More... | |
#define | _DEFAULT_NULL_REPLACEMENT "\\0" |
Default replacement for null character by EscapedTextBlock_struct. More... | |
#define | SUGGESTED_DEFAULT_MAX_LOG_LINES 1024 |
Recommended default amount of maximum buffered log lines. More... | |
#define | _ADD_NEW_LOG_ARG(typeEnum, member) |
#define | _ADD_NEW_LOG_ARG_WITH_VALUE_AND_LEN(typeEnum, member, val, len) |
#define | __EXPLICIT_LOG_MESSAGE_BODY |
Allow message to be built up using the << operator. More... | |
#define | AS_TEXT_BUFFER(s, ...) TextBlock_struct(s,__VA_ARGS__) |
Convenience label to enable passing text with known length to output operator<<(). More... | |
#define | AS_ESCAPED_TEXT_BUFFER(...) EscapedTextBlock_struct(__VA_ARGS__) |
Convenience label to enable passing text with known length to output operator<<(). More... | |
#define | AS_ESCAPED_TEXT_CHARACTER(...) EscapedTextBlock_struct(__VA_ARGS__) |
Convenience label to enable passing a single character to output operator<<(). More... | |
#define | AS_BINARY_BUFFER(d, l) BinaryBlock_struct(d,l) |
Convenience label to enable passing buffer with known length to output operator<<(). More... | |
#define | AS_HEXADECIMAL_BUFFER(d, ...) HexadecimalBlock_struct(d,__VA_ARGS__) |
Convenience label to enable passing buffer with known length to output operator<<() but output the bytes as hexadecimal characters. More... | |
#define | _LOGAPI_APPEND_TOKEN(component, suffix) component ## suffix |
#define | LOGAPI_APPEND_TOKEN(component, suffix) _LOGAPI_APPEND_TOKEN(component,suffix) |
Concatenate two tokens together to create new variable name. More... | |
#define | COMPONENT_LOG_MASK(component) LOGAPI_APPEND_TOKEN(component,_logLevelMask) |
Construct variable name for a component's active log mask. More... | |
#define | THIS_COMPONENT_LOG_MASK COMPONENT_LOG_MASK(THIS_COMPONENT) |
Construct variable name for the default component's active log mask. More... | |
#define | ISABLE_ALL_LOG_MASK 0 |
Master compile-time log-message disable mask. More... | |
#define | DISABLE_COMPONENT_LOG_MASK(component) LOGAPI_APPEND_TOKEN(ISABLE_, LOGAPI_APPEND_TOKEN(component,_logMask)) |
Defines the name of a component-specific compile-time log message disable mask. More... | |
#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)) ) |
Boolean expression to determine if component's active log mask has enabled at least one of the indicated levels. More... | |
#define | _COMPONENT_LEVEL(component, level) component ## _ ## level |
#define | COMPONENT_LEVEL(component, level) _COMPONENT_LEVEL(component, level) |
Compose a symbolic log mask name for a component and level. More... | |
#define | THIS_COMPONENT_LEVEL(level) COMPONENT_LEVEL(THIS_COMPONENT, level) |
Compose a symbolic log mask name for the default component and level. More... | |
#define | ENABLE_COMPONENT_LOG_LEVEL(component, level) COMPONENT_LOG_MASK(component) = (uint32_t) COMPONENT_LOG_MASK(component) | COMPONENT_LEVEL(component,level) |
Enable a symbolic log level for a component. More... | |
#define | DISABLE_COMPONENT_LOG_LEVEL(component, level) COMPONENT_LOG_MASK(component) = (uint32_t) COMPONENT_LOG_MASK(component) & ~ COMPONENT_LEVEL(component,level) |
Disable a symbolic log level for a component. More... | |
#define | COMPONENT_USER_LEVEL(component, baseLevel, N) (COMPONENT_LEVEL(component, baseLevel) | (COMPONENT_LEVEL(component, user) * (1 << N))) |
Generate compile-time constant representing a user-specific log level for a component. More... | |
#define | THIS_COMPONENT_USER_LEVEL(baseLevel, N) COMPONENT_USER_LEVEL(THIS_COMPONENT, baseLevel, N) |
Convenience macro that uses COMPONENT_USER_LEVEL() with THIS_COMPONENT as the component argument. More... | |
#define | DECLARE_COMPONENT_USER_LOG_MASK(component, name, baseLevel, N) enum { COMPONENT_LEVEL(component, name) = COMPONENT_USER_LEVEL(component,baseLevel,N) } |
Declare a user-specific log mask name. More... | |
#define | _DEFINE_COMPONENT_LOG_MASKS(component) |
Define default symbolic log mask names for a component, providing one level of macro expansion. More... | |
#define | DEFINE_COMPONENT_LOG_MASKS(component) _DEFINE_COMPONENT_LOG_MASKS(component) |
Define default symbolic log mask names for a component. More... | |
#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)) |
Automatically register a user-specific log mask name with the command line parser. More... | |
#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) |
Define and automatically register a user-specific log mask for a component using DECLARE_COMPONENT_USER_LOG_MASK(), and AUTO_REGISTER_USER_LOG_MASK(). More... | |
#define | _DECLARE_STANDARD_COMPONENT_VARS(component) |
Declare active log mask variable for a component and standard symbolic log level names, providing one level of macro expansion. More... | |
#define | DECLARE_STANDARD_COMPONENT_VARS(component) _DECLARE_STANDARD_COMPONENT_VARS(component) |
Declare active log mask variable for a component and its standard symbolic log level names. More... | |
#define | _DEFINE_STANDARD_COMPONENT_VARS_AND_MASK(component, maskValue) |
Define active log mask for a component, providing one level of macro expansion. More... | |
#define | DEFINE_STANDARD_COMPONENT_VARS_AND_MASK(component, maskValue) _DEFINE_STANDARD_COMPONENT_VARS_AND_MASK(component,maskValue) |
Define the active log mask variable for a component and its default log mask value. Used in situations where the bitmask value itself is provided, rather than a symbolic log level name. More... | |
#define | DEFINE_STANDARD_COMPONENT_VARS_AND_DEFAULT(component, defaultMaskName) _DEFINE_STANDARD_COMPONENT_VARS_AND_MASK(component,COMPONENT_LEVEL(component,defaultMaskName)) |
Define the active log mask variable for a component and its default mask value using a symbolic log level name. More... | |
#define | DEFINE_STANDARD_COMPONENT_VARS(component) DEFINE_STANDARD_COMPONENT_VARS_AND_DEFAULT(component,defaultMask) |
Define active log mask variable for a component. The default mask value is determined by the component's defaultMask symbolic log level name. More... | |
#define | DEFINE_STANDARD_VARS_FOR_THIS_COMPONENT() DEFINE_STANDARD_COMPONENT_VARS(THIS_COMPONENT) |
Define the active log mask variable for the default component. More... | |
#define | __LOGAPI_EXPAND_STRING1(x) #x |
#define | __LOGAPI_EXPAND_STRING2(x) __LOGAPI_EXPAND_STRING1(x) |
#define | THIS_COMPONENT_AS_STRING __LOGAPI_EXPAND_STRING2(THIS_COMPONENT) |
Provides the value of THIS_COMPONENT as a text string or const char[] value. More... | |
#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)); |
Automatically register a component's active log mask variable with the command line parser. More... | |
#define | AUTO_REGISTER_THIS_COMPONENT() AUTO_REGISTER_COMPONENT(THIS_COMPONENT); |
Automatically register default component's active log mask variable with the command line parser by invoking AUTO_REGISTER_COMPONENT() with THIS_COMPONENT. More... | |
#define | PROCESS_COMMANDLINE_LOG_FLAGS(argc, argv) LogMessageRecord::process_commandline_log_flags(&default_LogSubsystemInfo, argc, argv, &argc, argv) |
Standard mechanism to process logging-related command line arguments. More... | |
#define | _INIT_AND_OPEN_STANDARD_LOG(argc, argv, component, newArgc, newArgv) LogManager::initializeLogSubsystem(newArgc,newArgv,argc, argv, #component , & COMPONENT_LOG_MASK(component)); LogManager::newStandardLogFile() |
Initialize and open standard log file for a component, providing one level of macro expansion. More... | |
#define | _STDIN_FD 0 |
Platform-independent reference to standard in. More... | |
#define | _STDOUT_FD 1 |
Platform-independent reference to standard out. More... | |
#define | _STDERR_FD 2 |
Platform-independent reference to standard error. More... | |
#define | _INVALID_DESCRIPTOR -1 |
Platform-independent reference to invalid descriptor. More... | |
#define | THIS_COMPONENT_LOG_MANAGER LogManager::DEFAULT_LogManager |
Defines the default log manager object for the component. More... | |
#define | LOG_STREAM_OBJECT(n) |
Instantiates a LogMessageRecord object suitable for use as a ostringstream-like buffer. More... | |
#define | FORMAT_LOG_BUFFER(_var, src) |
Format a log buffer and return its address. More... | |
#define | RELEASE_LOG_BUFFER(src) src.getLogManager()->getBufferManager()->returnBlock(_bRec); } while (0) |
Release a log buffer formatted by FORMAT_LOG_BUFFER() More... | |
#define | APPEND_LOG_BUFFER(dest, src) |
Append log line data constructed from one LogMessageRecord object into another. More... | |
#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) |
Initialize and use standard out as log device for a component, providing one level of macro expansion. More... | |
#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); |
Create log manager for STDOUT or STDERR. More... | |
#define | INIT_STANDARD_LOG_FOR_COMPONENT(argc, argv, appName, newArgc, newArgv) _INIT_AND_OPEN_STANDARD_LOG(argc,argv,appName,newArgc,newArgv) |
Initialize the logging subsystem and create the default log file for an application. More... | |
#define | INIT_STANDARD_LOG_FOR_THIS_COMPONENT(argc, argv, newArgc, newArgv) INIT_STANDARD_LOG_FOR_COMPONENT(argc,argv,THIS_COMPONENT,newArgc,newArgv) |
Initialize the logging subsystem and create the default log file using the component name provided by THIS_COMPONENT . More... | |
#define | ALWAYS_EMIT_MESSAGE_TO_LOG(logHandle, mask) |
Create LogMessageRecord context for content that will always be emitted to indicated log manager. The active log mask variable has no control over such content. More... | |
#define | ALWAYS_EMIT_MESSAGE(lvl) ALWAYS_EMIT_MESSAGE_TO_LOG(THIS_COMPONENT_LOG_MANAGER, THIS_COMPONENT_LEVEL(lvl)) |
Create LogMessageRecord context for content that will always be emitted to default log manager. The active log mask variable has no control over such content. More... | |
#define | EMIT_CONDITIONAL_MESSAGE_FOR_COMPONENT_TO_LOG(component, mask, log) if (COMPONENT_LOG_ENABLED(component,mask)) ALWAYS_EMIT_MESSAGE_TO_LOG(log,mask) |
Create LogMessageRecord context for content that will be emitted to the indicated log manager only if enabled by the component's active log mask variable. More... | |
#define | EMIT_CONDITIONAL_MESSAGE_FOR_COMPONENT(component, lvl) EMIT_CONDITIONAL_MESSAGE_FOR_COMPONENT_TO_LOG(component,COMPONENT_LEVEL(component,lvl),THIS_COMPONENT_LOG_MANAGER) |
Create LogMessageRecord context for content that will be emitted to the default log manager only if enabled by the corresponding component's active log mask variable. More... | |
#define | EMIT_CONDITIONAL_MESSAGE(lvl) EMIT_CONDITIONAL_MESSAGE_FOR_COMPONENT(THIS_COMPONENT,lvl) |
Create LogMessageRecord context for content that will be emitted to the default log manager only if enabled by the default component's active log mask variable. More... | |
#define | LOG_MESSAGE_FORMAT(s) logObj.setLogFormat(s); |
Used to denote the log message format. More... | |
#define | LOG_ARG(arg) addLogArg(logObj, arg); |
Used to denote an argument for the log message. More... | |
#define | LOG_BINARY_ARG(arg, len) addLogArg(logObj, arg,len); |
Used to denote an binary buffer argument for the log message. More... | |
#define | LOG_ARG_USING_BUFFER(arg, bfr, bfrLen) addLogArg(logObj, arg, bfr, bfrLen) |
Used to denote an argument that requires a temporary buffer to permit the content to be formatted. More... | |
#define | AS_PLAIN_TEXT logObj.writeAsTextToBuffer(0); } while (0) |
Closing clause to emit log message record as unadorned text. More... | |
#define | AS_TIMESTAMPED_TEXT logObj.writeAsTextToBuffer(logObj.getLogManager()->getLogPrefixMask()); } while (0) |
Closing clause to emit log message record as text prefixed with an appropriate timestamp and other information. This is the preferred mechanism. More... | |
#define | AS_PREFIXED_TEXT(selectionMask) logObj.writeAsTextToBuffer(selectionMask); } while (0) |
Closing clause to emit log message record as text prefixed with arbitrarily selected fields. More... | |
#define | AS_BINARY_RECORD logObj.writeAsBinaryToBuffer(logObj.getLogManager()->getLogPrefixMask()); } while (0) |
Closing clause to emit log message record as a binary record. More... | |
#define | WITH_DATE_TIME_LEVEL logObj.writeAsTextToBuffer( LogMessageRecord::LOG_DATESTAMP | LogMessageRecord::LOG_TIMESTAMP | LogMessageRecord::LOG_ERROR_LEVEL); } while (0) |
log as $date_time $log_level $msg More... | |
#define | WITH_TIME_LEVEL logObj.writeAsTextToBuffer(LogMessageRecord::LOG_TIMESTAMP | LogMessageRecord::LOG_ERROR_LEVEL); } while (0) |
log as $time $log_level $msg More... | |
#define | LOG_WHEN_OSTREAM(stream, lvl) if (COMPONENT_LOG_ENABLED(THIS_COMPONENT,THIS_COMPONENT_LEVEL(lvl))) do { stream |
Convenience macro for conditional log output using a std::ostream or allomorphic equivalent. More... | |
#define | OSTREAM_ENDLINE "\n"; } while (0) |
End-of-Line fragment for use with LOG_WHEN_OSTREAM . More... | |
#define | LOG_TO_DESCRIPTOR(output, lvl) EMIT_CONDITIONAL_MESSAGE_FOR_COMPONENT_TO_LOG(THIS_COMPONENT,lvl,output ## _LogManager) |
Convenience macro to emit conditional message for THIS_COMPONENT via a LogManager associated with standard output or error. More... | |
#define | LOG_ALWAYS(lvl) ALWAYS_EMIT_MESSAGE(lvl); logObj |
Convenience declaration for log line that will be always be emitted for the default component to the default log manager. More... | |
#define | IFLOG_ALWAYS(lvl) if (THIS_COMPONENT_LOG_MANAGER != nullptr) ALWAYS_EMIT_MESSAGE(lvl); logObj |
Convenience declaration for log line that will always be emitted for the default component if the default log manager has been initialized. More... | |
#define | LOG_WHEN(lvl) EMIT_CONDITIONAL_MESSAGE(lvl); logObj |
Convenience declaration for log line that will be conditionally emitted for the default component to the default log manager if the indicated log level is enabled. More... | |
#define | IFLOG_WHEN(lvl) if (THIS_COMPONENT_LOG_MANAGER != nullptr) EMIT_CONDITIONAL_MESSAGE(lvl); logObj |
Convenience declaration for log line that will be conditionally emitted for the default component if the default log manager has been initialized and the indicate log level is enabled. More... | |
#define | ENDREC "\n"; logObj.writeAsTextToBuffer(logObj.getLogManager()->getLogPrefixMask()); } while (0) |
Closing attribute to complete a LOG_ALWAYS() or LOG_WHEN() statement and emit the log message as a text line. The result will be subject to the LogManager object's current prefix mask, which might inhibit the output of elements such as the date, thread id, file name, source line number, etc. More... | |
#define | BINARY_ENDREC "\n"; logObj.writeAsBinaryToBuffer(logObj.getLogManager()->getLogPrefixMask()); } while (0) |
Closing attribute to complete LOG_ALWAYS() or LOG_WHEN statement and emit the log message as a binary record. More... | |
#define | LOG_ENDLINE ENDREC |
Closing clause for text line output using << operators. More... | |
#define | BINARY_LOG_ENDLINE BINARY_ENDREC |
Closing close for binary record output using << operators. More... | |
#define | LOG_COMPONENT_INTO(mgrPtr, component, lvl) EMIT_CONDITIONAL_MESSAGE_FOR_COMPONENT_TO_LOG(component,COMPONENT_LEVEL(component,lvl),mgrPtr); logObj |
Conditionally emits a log message constructed using the << operator. The end of line should be terminated with either LOG_ENDLINE or BINARY_LOG_ENDLINE. More... | |
#define | LOG_COMPONENT_ALWAYS_INTO(mgrPtr, component, lvl) ALWAYS_EMIT_MESSAGE_TO_LOG(mgrPtr,COMPONENT_LEVEL(component,lvl)); logObj |
Always emits a log message constructed using the << operator. The end of line should be terminated with either LOG_ENDLINE or BINARY_LOG_ENDLINE. More... | |
#define | LOG_INTO(mgrPtr, lvl) LOG_COMPONENT_INTO(mgrPtr,THIS_COMPONENT,lvl) |
Convenience macro that uses LOG_COMPONENT_INTO to conditionally emit a message associated with THIS_COMPONENT. More... | |
#define | LOG_ALWAYS_INTO(mgrPtr, lvl) LOG_COMPONENT_ALWAYS_INTO(mgrPtr,THIS_COMPONENT,lvl) |
Convenience macro that uses LOG_COMPONENT_INTO to emit a message associated with THIS_COMPONENT. More... | |
#define | LOG_COUT(lvl) LOG_INTO(LogManager::STDOUT_LogManager, lvl) |
Convenience macro that uses LOG_INTO() to conditionally log a message to standard output. More... | |
#define | LOG_CERR(lvl) LOG_INTO(LogManager::STDERR_LogManager, lvl) |
Convenience macro that uses LOG_INTO() to conditionally log a message to standard error. More... | |
#define | LOG_COMPONENT_COUT(component, lvl) LOG_COMPONENT_INTO(LogManager::STDOUT_LogManager,component,lvl) |
Convenience macro that uses LOG_COMPONENT_INTO to conditionally log a message to standard output. More... | |
#define | LOG_COMPONENT_CERR(component, lvl) LOG_COMPONENT_INTO(LogManager::STDERR_LogManager,component,lvl) |
Convenience macro that uses LOG_COMPONENT_INTO to conditionally log a message to standard error. More... | |
#define | LOG_COMPONENT(component, lvl) LOG_COMPONENT_INTO(THIS_COMPONENT_LOG_MANAGER,component,lvl) |
Convenience macro that uses LOG_COMPONENT_INTO to conditionally log a message to the default log manager, which is in turn specified by the THIS_COMPONENT_LOG_MANAGER macro. More... | |
#define | LOG_COMPONENT_ALWAYS(component, lvl) LOG_COMPONENT_ALWAYS_INTO(THIS_COMPONENT_LOG_MANAGER,component,lvl) |
Convenience macro that uses LOG_COMPONENT_ALWAYS_INTO to log a message to the default log manager, which is in turn specified by the THIS_COMPONENT_LOG_MANAGER macro. More... | |
#define | IFLOG_COMPONENT(component, lvl) if (OME_EXPECT_TRUE(THIS_COMPONENT_LOG_MANAGER != nullptr)) LOG_COMPONENT_INTO(THIS_COMPONENT_LOG_MANAGER,component,lvl) |
Only if the default log manager has been created, uses the LogManager specified by the THIS_COMPONENT_LOG_MANAGER macro to conditionally emit a log message. More... | |
#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 |
Similiar to IFLOG_COMPONENT(), but the message cannot be disabled using the component's logLevel mask. More... | |
#define | SPLIT_ACROSS_LINES(label, ...) |
Label a block of text that is split across multiple log lines. More... | |
#define | _OUTPUT_MEMBER_FIELD(s, f) << " " #f "=" << (s). ## f |
Convenience macro to output a member field. More... | |
#define | _OUTPUT_MEMBER_FIELD_AS_STRING_BLOCK(s, f, l) << " " #f "=\"" << AS_ESCAPED_TEXT_BUFFER((s). ## f, l) << "\"" |
Convenience macro to output a member field as a string. More... | |
#define | _OUTPUT_MEMBER_FIELD_AS_STRING(s, f) _OUTPUT_MEMBER_FIELD_AS_STRING_BLOCK(s,f,strlen((s). ## f)) |
Convenience macro to output a member field as a string, with the length determined at runtime. More... | |
Typedefs | |
typedef uint_fast32_t | LogMaskPrimitiveType_t |
typedef SMV_StandaloneNumeric< LogMaskPrimitiveType_t > | LogMaskType_t |
typedef const struct StringInROM_struct * | StringInROM |
Typedef to mark string data in text segment. More... | |
Enumerations | |
enum | { LOG_LINE_BINARY_FORMAT_VER1 = '1', LOG_LINE_BINARY_FORMAT_LE = 'L', LOG_LINE_BINARY_FORMAT_BE = 'B', LOG_LINE_BINARY_FORMAT_BE_S360 = 'I' } |
Functions | |
void | addLogArg (LogMessageRecord &logRec, const int32_t arg) |
Add log argument of indicated type. More... | |
void | addLogArg (LogMessageRecord &logRec, const uint32_t arg) |
Add log argument of indicated type. More... | |
void | addLogArg (LogMessageRecord &logRec, const int64_t arg) |
Add log argument of indicated type. More... | |
void | addLogArg (LogMessageRecord &logRec, const uint64_t arg) |
Add log argument of indicated type. More... | |
void | addLogArg (LogMessageRecord &logRec, const size_t arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
void | addLogArg (LogMessageRecord &logRec, const ssize_t arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
void | addLogArg (LogMessageRecord &logRec, const float arg) |
Add log argument of indicated type. More... | |
void | addLogArg (LogMessageRecord &logRec, const double arg) |
Add log argument of indicated type. More... | |
void | addLogArg (LogMessageRecord &logRec, const char arg) |
Add log argument of indicated type. More... | |
void | addLogArg (LogMessageRecord &logRec, const POSIXtimeInNanoseconds arg) |
Add log argument of indicated type. More... | |
void | addLogArg (LogMessageRecord &logRec, const char *arg) |
Add text string argument. More... | |
void | addLogArg (LogMessageRecord &logRec, StringInROM arg) |
Add text string data which is expected to be permanently available. More... | |
void | addLogArg (LogMessageRecord &logRec, const void *arg) |
Add log argument of indicated type. More... | |
void | addLogArg (LogMessageRecord &logRec, const std::string &arg) |
Add log argument of indicated type. More... | |
void | addLogArg (LogMessageRecord &logRec, uint_fast32_t len, const char *arg) |
Add text string argument with known length. More... | |
void | addLogArg (LogMessageRecord &logRec, const void *arg, const size_t l) |
Add log argument representing a pointer. More... | |
void | addLogArg (LogMessageRecord &logRec, const TextBlock_struct &arg) |
Add text string argument with known length. More... | |
void | addLogArg (LogMessageRecord &logRec, const BinaryBlock_struct &arg) |
Add binary string argument with known length. More... | |
void | addLogArg (LogMessageRecord &logRec, const HexadecimalBlock_struct &arg) |
Add binary string argument with known length. More... | |
LogMessageRecord & | operator<< (LogMessageRecord &logRec, const POSIXtimeInNanoseconds arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
Output a POSIXtimeInNanoseconds into a LogMessageRecord. More... | |
LogMessageRecord & | operator<< (LogMessageRecord &logRec, const int32_t arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
LogMessageRecord & | operator<< (LogMessageRecord &logRec, const uint32_t arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
LogMessageRecord & | operator<< (LogMessageRecord &logRec, const int64_t arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
LogMessageRecord & | operator<< (LogMessageRecord &logRec, const uint64_t arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
LogMessageRecord & | operator<< (LogMessageRecord &logRec, const float arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
LogMessageRecord & | operator<< (LogMessageRecord &logRec, const double arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
LogMessageRecord & | operator<< (LogMessageRecord &logRec, const char arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
LogMessageRecord & | operator<< (LogMessageRecord &logRec, StringInROM arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
std::ostream & | operator<< (std::ostream &os, StringInROM arg) |
Convert StringInROM type back to true const char * for output on std::ostream. More... | |
std::ostream & | operator<< (std::ostream &os, const TextBlock_struct &arg) |
std::ostream & | operator<< (std::ostream &os, const BinaryBlock_struct &arg) |
std::ostream & | operator<< (std::ostream &os, const HexadecimalBlock_struct &arg) |
std::ostream & | operator<< (std::ostream &os, const EscapedTextBlock_struct &arg) |
LogMessageRecord & | operator<< (LogMessageRecord &logRec, const char *arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
LogMessageRecord & | operator<< (LogMessageRecord &logRec, const std::string &arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
LogMessageRecord & | operator<< (LogMessageRecord &logRec, const void *arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
LogMessageRecord & | operator<< (LogMessageRecord &logRec, const TextBlock_struct &arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
LogMessageRecord & | operator<< (LogMessageRecord &logRec, const BinaryBlock_struct &arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
LogMessageRecord & | operator<< (LogMessageRecord &logRec, const HexadecimalBlock_struct &arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
LogMessageRecord & | operator<< (LogMessageRecord &logRec, const EscapedTextBlock_struct &arg) OME_ALWAYS_INLINE OME_ALWAYS_OPTIMIZE("-O3") |
DEFINE_COMPONENT_LOG_MASKS (app) | |
DEFINE_COMPONENT_LOG_MASKS (io) | |
LogMaskType_t | COMPONENT_LOG_MASK (io) |
Default io-or-library-related log mask. More... | |
template<typename STREAM > | |
STREAM & | operator<< (STREAM &os, const struct in_addr &addr) |
template<typename STREAM > | |
STREAM & | operator<< (STREAM &os, const struct in6_addr &addr) |
template<typename STREAM > | |
STREAM & | operator<< (STREAM &os, const struct sockaddr_in &s) |
template<typename STREAM > | |
STREAM & | operator<< (STREAM &os, const struct sockaddr_in6 &s) |
template<typename STREAM > | |
STREAM & | operator<< (STREAM &os, const struct sockaddr_un &s) |
template<typename STREAM > | |
STREAM & | operator<< (STREAM &os, const struct sockaddr &s) |
Variables | |
struct LogSubsystemInfo | default_LogSubsystemInfo |
Default descriptive information for Logging subsystem. More... | |
LogMaskType_t | COMPONENT_LOG_MASK (app) |
Default application log mask; will be aliased to component. More... | |
FARGOS Logging API.
NOTE: many of the convenience macros in this API expect the THIS_COMPONENT
macro to be eventually defined by the user. It does not have to be set before the logging_api.hpp header file is included, but it will need to be defined before the relevant convenience macros are used:
EMIT_CONDITIONAL_MESSAGE(), ALWAYS_EMIT_MESSAGE(), INIT_STANDARD_LOG_FOR_THIS_COMPONENT(), DEFINE_STANDARD_VARS_FOR_THIS_COMPONENT(). THIS_COMPONENT_LEVEL(), THIS_COMPONENT_LOG_MASK
There is no DECLARE_STANDARD_VARS_FOR_THIS_COMPONENT()
because declarations are typically placed in header files, which in turn may be consumed by different components. As a general principle, the content of the header file is not intended to change based on the definition of THIS_COMPONENT
.
The default LogManager object used by the convenience macros is specified by the THIS_COMPONENT_LOG_MANAGER macro. If something other than LogManager::DEFAULT_LogManager is desired, the macro should be set prior to including this header file.
The LOG_WHEN(), LOG_ALWAYS(), ENDREC macros permit logging output using the "<<" operator. In the expected case, LOG_USING_OSTREAM
will be undefined; however, before including this file, it can be defined to something like std::cout
to force these macros to simply output to an ostream
-like object rather than use a LogMessageRecord.
![]() | Generated: Fri Jul 31 2020 18:19:15
Support Information |