- HandlerMinelayerData: BUILD_RTI Guards für RTI-Abhängigkeiten - svcTabCommon: Export-Header-Fix via Fallback-Target - TrainingAreaBase: Stub-Header für BUILD_RTI=OFF - ddsfts: Include-Pfad und Dependency-Fixes - BUILD_RTI=OFF Compilation vollständig unterstützt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Entire-Checkpoint: 01M0JNZA586SACX1PRZ2DJAE5S
2731 lines
100 KiB
C
2731 lines
100 KiB
C
/*
|
|
* (c) Copyright, Real-Time Innovations, 2002-2016.
|
|
* All rights reserved.
|
|
* No duplications, whole or partial, manual or electronic, may be made
|
|
* without express written permission. Any such copies, or
|
|
* revisions thereof, must display this notice unaltered.
|
|
* This code contains trade secrets of Real-Time Innovations, Inc.
|
|
*/
|
|
|
|
#ifndef log_common_h
|
|
#define log_common_h
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include "log_makeheader.h"
|
|
#include "log_dll.h"
|
|
#include "log_legacy.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*e \file
|
|
* \brief Defines common log interface.
|
|
*/
|
|
|
|
/*e \mainpage
|
|
* The Log module defines the common log interface for all modules.
|
|
*
|
|
* All modules in NDDS implement their own custom log interface for
|
|
* displaying error messages. This custom log interface, which is
|
|
* defined in \c Log.c for each module, re-uses much of the core infrastructure
|
|
* provided by this Log module.
|
|
*/
|
|
|
|
/*e \defgroup RTILogModule RTILog
|
|
\ingroup RTI
|
|
\brief Centralized logging infrastructure for all waveworks modules.
|
|
|
|
The provided infrastructure has been grouped in different categories
|
|
as listed on this page.
|
|
|
|
*/
|
|
|
|
/*******************************************************************************/
|
|
/*e \defgroup RTILogBitmapClass RTILogBitmap
|
|
\ingroup RTILogModule
|
|
\brief Log messages can be selectively enabled or disabled by type.
|
|
This page defines the different types of log messages.
|
|
|
|
Printing log messages is crucial for debugging problems and
|
|
examining running code in general. Various types of log messages
|
|
exist: some messages report catastrophic failure,
|
|
others merely offer a warning to the user or print diagnostic information.
|
|
|
|
NDDS makes it possible to selectively turn on or
|
|
off different types of log messages. This prevents information overload
|
|
during debugging and allows the user to focus on the information that
|
|
matters.
|
|
|
|
This page defines the various types of log messages
|
|
that exist within NDDS.
|
|
Each type of log message is represented by a bit in a global bitmask.
|
|
Bitmasks can be ORed together to represent (and enable/disable)
|
|
a group of log message types.
|
|
|
|
The log message type bitmasks are used for
|
|
creating the logging interface for other NDDS modules.
|
|
|
|
For example, the netio module defines the following interface for
|
|
logging exceptions:
|
|
|
|
\code
|
|
#define RTINetioLog_exception \
|
|
if ((RTINetioLog_g_instrumentationMask & RTI_LOG_BIT_EXCEPTION) && \
|
|
(RTINetioLog_g_submoduleMask & RTI_NETIO_CURRENT_SUBMODULE)) \
|
|
RTILogMessage_log
|
|
\endcode
|
|
|
|
RTINetioLog_exception(...) is called in Netio code to log an exception.
|
|
Based on the code above however, an actual message will be
|
|
printed only when the
|
|
\ref RTI_LOG_BIT_EXCEPTION bit is set in the global instrumentation
|
|
mask of the Netio module. This enables selectively turning exception
|
|
messages on or off for the Netio module. The same holds for all
|
|
other types of log messages.
|
|
|
|
Please refer to the logging API of a module for information on how
|
|
to set the instrumentation mask for that module.
|
|
*/
|
|
/*******************************************************************************/
|
|
|
|
/*e \ingroup RTILogBitmapClass
|
|
\brief Bitmaps are defined as 32 bit integers.
|
|
It is used to represent the verbosity of the message.
|
|
*/
|
|
typedef unsigned int RTILogBitmap;
|
|
|
|
|
|
/*e \ingroup RTILogBitmapClass
|
|
\brief Log all fatal errors.
|
|
*/
|
|
#define RTI_LOG_BIT_FATAL_ERROR (0x00000001U)
|
|
|
|
/*e \ingroup RTILogBitmapClass
|
|
\brief Log all exceptions; these should be fixed completely before shipping!
|
|
*/
|
|
#define RTI_LOG_BIT_EXCEPTION (0x00000002U)
|
|
|
|
/*e \ingroup RTILogBitmapClass
|
|
\brief Log all warnings; should check the source before shipping.
|
|
*/
|
|
#define RTI_LOG_BIT_WARN (0x00000004U)
|
|
|
|
/*e \ingroup RTILogBitmapClass
|
|
\brief Log what is happening due to local object creation and destruction.
|
|
*/
|
|
#define RTI_LOG_BIT_LOCAL (0x00000008U)
|
|
|
|
/*e \ingroup RTILogBitmapClass
|
|
\brief Log what is happening due to what other applications
|
|
(not necessarily on another host, but in different address space)
|
|
are creating and destroying.
|
|
*/
|
|
#define RTI_LOG_BIT_REMOTE (0x00000010U)
|
|
|
|
/*e \ingroup RTILogBitmapClass
|
|
\brief Log periodic activities.
|
|
Different than \ref RTI_LOG_BIT_LOCAL or \ref RTI_LOG_BIT_REMOTE
|
|
in that this is NOT related to creation or destruction.
|
|
|
|
This bit is used for periodic activities, such as sending a packet.
|
|
Disabling this type of log message can significantly reduce logging
|
|
output.
|
|
*/
|
|
#define RTI_LOG_BIT_PERIODIC (0x00000020U)
|
|
|
|
/*e \ingroup RTILogBitmapClass
|
|
* \brief For logging activity context enter/exit information.
|
|
* IT IS DEPRECATED. It should not be used to log a message.
|
|
*/
|
|
#define RTI_LOG_BIT_ACTIVITY (0x00000040U)
|
|
|
|
/*e \ingroup RTILogBitmapClass
|
|
* \brief Dump data content, to see what is being sent or received.
|
|
* IT IS DEPRECATED. It should not be used to log a message.
|
|
*/
|
|
#define RTI_LOG_BIT_CONTENT (0x00000080U)
|
|
|
|
/*e \ingroup RTILogBitmapClass
|
|
* \brief For logging those things that do not really belong in any of
|
|
* the other logging categories.
|
|
* IT IS DEPRECATED. It should not be used to log a message.
|
|
*/
|
|
#define RTI_LOG_BIT_OTHER (0x00000100U)
|
|
|
|
/*e \ingroup RTILogBitmapClass
|
|
\brief This will be the log level stored in the thread specific structrue
|
|
for the log message if the Log macro had not specified the log level.
|
|
This is set to 0x04000000 as this has to be mapped to verbosity in
|
|
Java and Java expects signed integer. So we cannot use the msb.
|
|
*/
|
|
#define RTI_LOG_BIT_UNINITIALIZED (0x04000000U)
|
|
|
|
/*e
|
|
* \ingroup RTILogBitmapClass
|
|
* \brief Bitmap mask with all of the RTI log bits enabled.
|
|
*/
|
|
#define RTI_LOG_BITMAP_ALL (0xFFFFFFFFU)
|
|
|
|
/*e
|
|
* \ingroup RTILogBitmapClass
|
|
* \brief Bitmap mask with no RTI log bits enabled.
|
|
*/
|
|
#define RTI_LOG_BITMAP_NONE (0x00000000U)
|
|
|
|
/*e \ingroup RTILogBitmapClass
|
|
\brief Default bitmap.
|
|
|
|
When using this default bitmap, only exceptions and fatal errors
|
|
will be logged.
|
|
*/
|
|
#define RTI_LOG_BITMAP_DEFAULT (RTI_LOG_BIT_EXCEPTION | RTI_LOG_BIT_FATAL_ERROR)
|
|
|
|
/*
|
|
* It matches the highest bit that can be used to log a message.
|
|
* Currently, corresponds to RTI_LOG_BIT_PERIODIC which is associated
|
|
* with the highest log level/verbosity we support in the public API (DEBUG).
|
|
*
|
|
* The other log bit (RTI_LOG_BIT_ACTIVITY, RTI_LOG_BIT_CONTENT,
|
|
* RTI_LOG_BIT_OTHER) are deprecated and should not be used for logging.
|
|
*/
|
|
#define RTI_LOG_BITMAP_MAX_PUBLIC_LOG_LEVEL (RTI_LOG_BIT_PERIODIC)
|
|
|
|
/*e
|
|
* \ingroup RTILogBitmapClass
|
|
* \brief Enables setting the logging verbosity using a single number.
|
|
* @note This macro assumes the log message bitmaps are such that
|
|
* a more significant bit corresponds to a more verbose message.
|
|
* That is, nothing will be enabled for verbosity < 0,
|
|
* \ref RTI_LOG_BIT_FATAL_ERROR will be enabled for verbosity = 0,
|
|
* \ref RTI_LOG_BIT_EXCEPTION will be enabled for verbosity = 1,
|
|
* and \ref RTI_LOG_BIT_WARN requires at least verbosity = 2.
|
|
* A given verbosity value automatically enables all log messages
|
|
* corresponding to lower verbosity values.
|
|
*/
|
|
#define RTILogBitmap_setFromVerbosity(verbosity) \
|
|
(((verbosity) < 0)? 0 : (~(0xFFFFFFFFU << ((verbosity) + 1))))
|
|
|
|
/****************************************************************************/
|
|
/*e \defgroup RTILogNumberBitmapClass RTILogNumberBitmap
|
|
\ingroup RTILogModule
|
|
\brief Each specific log message can also be represented by a unique
|
|
matching log message number. This page defines how to compose and
|
|
interpret log message numbers.
|
|
|
|
For each standard log message, NDDS defines a corresponding
|
|
log message number. This makes it possible to reduce the
|
|
footprint of the NDDS libraries by not linking the error
|
|
message strings. Instead, all log messages are represented by numbers.
|
|
To report problems, production code in the field can make use of log
|
|
message numbers only, while development code can use the
|
|
actual log message.
|
|
|
|
A log message number contains a variety of information, such as
|
|
what product generated the message (e.g. NDDS), what module
|
|
(e.g. netio, commend), submodule and so on. This information is encoded
|
|
in separate parts of the 32 bit log message number, as described on
|
|
this page.
|
|
|
|
When building an NDDS module, link with \c Log_silent.msg.c instead of
|
|
\c Log_normal.msg.c to use log numbers instead of log messages and
|
|
thereby reduce the footprint of that module.
|
|
|
|
Example (from \c Log_normal.msg.c in Netio):
|
|
|
|
\code
|
|
const struct RTILogMessage RTI_NETIO_LOG_BLOCK_s = {
|
|
PRODUCT_WAVEWORKS|MODULE_NETIO|0,
|
|
"%s blocking\n"
|
|
};
|
|
\endcode
|
|
|
|
uniquely identifies the Netio blocking log message by the bitmap
|
|
|
|
\code
|
|
PRODUCT_WAVEWORKS|MODULE_NETIO|0
|
|
\endcode
|
|
|
|
which corresponds to 0x02070000 (message 0 in module Netio of the Waveworks
|
|
product). See also \ref PRODUCT_WAVEWORKS and \ref MODULE_NETIO.
|
|
|
|
The counterpart in \c Log_silent.msg.c of the code snippet above is
|
|
|
|
\code
|
|
const struct RTILogMessage RTI_NETIO_LOG_BLOCK_s = {
|
|
PRODUCT_WAVEWORKS|MODULE_NETIO|0,
|
|
NULL
|
|
};
|
|
\endcode
|
|
|
|
which indeed does not contain the string and only the log message number.
|
|
|
|
@see RTILogMessageClass
|
|
|
|
*/
|
|
/****************************************************************************/
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Product portion of log message number => up to 256 products allowed.
|
|
|
|
@see PRODUCT_WAVEWORKS
|
|
*/
|
|
#define RTI_LOG_PRODUCT_MASK (0xFF000000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Module portion of log message number => up to 256 modules
|
|
per product allowed.
|
|
*/
|
|
#define RTI_LOG_MODULE_MASK (0x00FF0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Submodule portion of log message number => up to 64 submodules
|
|
per module allowed.
|
|
*/
|
|
#define RTI_LOG_SUBMODULE_MASK (0x0000FC00U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Message specific to a submodule => up to 1024 messages
|
|
per submodule allowed.
|
|
*/
|
|
#define RTI_LOG_MESSAGE_NUMBER_MASK (0x000003FFU)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Macro to extract the product ID from the log message number.
|
|
|
|
@see RTI_LOG_PRODUCT_MASK
|
|
*/
|
|
#define RTI_LOG_getProductId(mask) (((mask) & RTI_LOG_PRODUCT_MASK) >> 24U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Macro to extract the module ID from the log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define RTI_LOG_getModuleId(mask) (((mask) & RTI_LOG_MODULE_MASK) >> 16U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Macro to extract the submodule ID from the log message number.
|
|
|
|
@see RTI_LOG_SUBMODULE_MASK
|
|
*/
|
|
#define RTI_LOG_getSubmoduleId(mask) (((mask) & RTI_LOG_SUBMODULE_MASK) >> 10U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Macro to extract the error ID from the log message number.
|
|
|
|
@see RTI_LOG_MESSAGE_NUMBER_MASK
|
|
*/
|
|
#define RTI_LOG_getErrorId(mask) ((mask) & RTI_LOG_MESSAGE_NUMBER_MASK)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief The most significant byte of a
|
|
log message number defines the product that generated the log message.
|
|
Use this bitmask to specify Waveworks.
|
|
|
|
@see RTI_LOG_PRODUCT_MASK
|
|
*/
|
|
#define PRODUCT_WAVEWORKS (0x02000000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify LOG module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_LOG (0x000000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify TEST module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_TEST (0x010000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify OSAPI module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_OSAPI (0x020000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify CLOCK module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_CLOCK (0x030000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify REDA module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_REDA (0x040000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify ADVLOG module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_ADVLOG (0x050000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify EVENT module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_EVENT (0x060000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify CDR module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_CDR (0x070000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify TRANSPORT module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_TRANSPORT (0x080000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify NETIO module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_NETIO (0x090000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify MIG module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_MIG (0x0A0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify COMMEND module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_COMMEND (0x0B0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify DISC module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_DISC (0x0C0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify PRES module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_PRES (0x0D0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify core_version module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_VERS (0x0E0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify DDS moduleS in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_DDS (0x0F0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify TESTSUITE module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_TESTSUITE (0x100000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify RTIDDSGEN(2) module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_RTIDDSGEN (0x110000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
* \brief Bitmap to specify SECURITY module in log message number.
|
|
*
|
|
* @see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_SECURITY (0x120000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify DISCSTATIC module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_DISCSTATIC (0x130000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify lua module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_LUA (0x140000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify DL_DRIVER module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_DLDRIVER (0x150000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify WRITERHISTORY module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_WRITERHISTORY (0x160000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify PERSISTENCE module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_PERSISTENCE (0x170000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify transport lbrtps modules in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_LBRTPS (0x1A0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify RTIXML module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_RTIXML (0x1B0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify ROUTER module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_ROUTER (0x1C0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify METP module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_METP (0x1D0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify TRANSPORT_TCP module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_TRANSPORT_TCP (0x1E0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify RTITLS module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_RTITLS (0x1F0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify transport_zrtps module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_ZRTPS (0x210000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify LBPDISCOVERY module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_LBPDISCOVERY (0x230000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify LBEDISCOVERY module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_LBEDISCOVERY (0x240000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify TRANSPORT_PCIE module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_TRANSPORT_PCIE (0x250000U)
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify XMQ module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_XMQ (0x260000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify LUA_BINDING module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_LUABINDING (0x270000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify QUEUE module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_QUEUE (0x280000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify RECORDER module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_RECORDER (0x290000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify RTIXMLUTILS module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_RTIXMLUTILS (0x2A0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify CDS module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_CDS (0x2B0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
\brief Bitmap to specify XCDR module in log message number.
|
|
|
|
@see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_XCDR (0x2C0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
* \brief Bitmap to specify Property module in log message number.
|
|
*
|
|
* @see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_PROPERTY (0x2D0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
* @brief Bitmap to specify NETIO_CAP module in log message number.
|
|
*
|
|
* @see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_NETIO_CAP (0x2E0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
* \brief Bitmap to specify JSON module in log message number.
|
|
*
|
|
* @see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_JSON (0x2F0000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
* \brief Bitmap to specify APPUTILS module in log message number.
|
|
*
|
|
* @see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_APPUTILS (0x300000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
* \brief Bitmap to specify MONITORING_2.0 module in log message number.
|
|
*
|
|
* @see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_MONITORING (0x310000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
* \brief Bitmap to specify MONITORINGCOLLECTOR module in log message number.
|
|
*
|
|
* @see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_MONITORINGCOLLECTOR (0x320000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
* \brief Bitmap to specify TYPEUTILS module in log message number.
|
|
*
|
|
* @see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_TYPEUTILS (0x330000U)
|
|
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
* \brief Bitmap to specify HTTPS module in log message number.
|
|
*
|
|
* @see RTI_LOG_MODULE_MASK
|
|
*/
|
|
#define MODULE_RTIHTTPS (0x340000U)
|
|
/*******************************************************************************/
|
|
|
|
/*e \defgroup RTILogCategoryBitsClass RTILogCategoryBits
|
|
* \ingroup RTILogModule
|
|
* \brief Bitmap used to define logging categories that are set within
|
|
* the activitiy context.
|
|
*/
|
|
typedef unsigned int RTILogCategoryBits;
|
|
|
|
/*e
|
|
* \ingroup RTILogCategoryBitsClass
|
|
* \brief Bitmap to set DISCOVERY category
|
|
*/
|
|
#define RTI_LOG_CATEGORY_DISCOVERY_BIT (0x00000001U << 0U)
|
|
|
|
#ifndef RTI_EXCLUDE_BB_SECURITY
|
|
/*e
|
|
* \ingroup RTILogCategoryBitsClass
|
|
* \brief Bitmap to set SECURITY category
|
|
*/
|
|
#define RTI_LOG_CATEGORY_SECURITY_BIT (0x00000001U << 1U)
|
|
#endif /* RTI_EXCLUDE_BB_SECURITY */
|
|
|
|
/*e
|
|
* \ingroup RTILogCategoryBitsClass
|
|
* \brief Bitmap to set USER category
|
|
*/
|
|
#define RTI_LOG_CATEGORY_USER_BIT (0x00000001U << 2U)
|
|
|
|
/*e \ingroup RTILogCategoryBitsClass
|
|
* \brief Bitmap to set no categories
|
|
*/
|
|
#define RTI_LOG_CATEGORY_NONE (0x00000000U)
|
|
|
|
/*e \ingroup RTILogCategoryBitsClass
|
|
* \brief Bitmap to set all categories
|
|
*/
|
|
#define RTI_LOG_CATEGORY_ALL (~RTI_LOG_CATEGORY_NONE)
|
|
/*******************************************************************************/
|
|
|
|
/*
|
|
* RTILogCategoryMask identifies the category of a message.
|
|
* The category is used for:
|
|
* - Filtering what messages are logged according to the configured
|
|
* verbosity.
|
|
*/
|
|
typedef unsigned int RTILogCategoryMask;
|
|
|
|
/*i
|
|
\brief RTILogLevel identifies the logLevel of a message.
|
|
The logLevel is used for:
|
|
- Filtering what messages are logged according to the configured
|
|
verbosity.
|
|
- Identifying the logged message by its logLevel.
|
|
- Setting the logged message printFormat.
|
|
*/
|
|
typedef unsigned int RTILogLevel;
|
|
|
|
/*i
|
|
* @brief According to the syslog definition, the facility is a number that
|
|
* identifies a process. In RTI Connext, it will identify the source of the
|
|
* message: user, security, middleware, or service.
|
|
*/
|
|
typedef unsigned int RTILogFacility;
|
|
|
|
|
|
#define RTI_LOG_COUNT_LOG_LEVELS 6
|
|
|
|
/*e
|
|
\brief Log level fatal error
|
|
*/
|
|
#define RTI_LOG_LEVEL_FATAL_ERROR 0
|
|
|
|
/*e
|
|
\brief Log level exception
|
|
*/
|
|
#define RTI_LOG_LEVEL_ERROR 1
|
|
|
|
/*e
|
|
\brief Log level warning
|
|
*/
|
|
#define RTI_LOG_LEVEL_WARNING 2
|
|
|
|
/*e
|
|
\brief Log level local
|
|
*/
|
|
#define RTI_LOG_LEVEL_STATUS_LOCAL 3
|
|
|
|
/*e
|
|
\brief Log level remote
|
|
*/
|
|
#define RTI_LOG_LEVEL_STATUS_REMOTE 4
|
|
|
|
/*e
|
|
\brief Log level debug
|
|
*/
|
|
#define RTI_LOG_LEVEL_DEBUG 5
|
|
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
@brief Get the logLevel from the instrumentBit.
|
|
In the case that the instrumentBit is a mask, get the logLevel more
|
|
restrictive.
|
|
*/
|
|
#define RTILog_getLogLevelFromInstrumentBit(instrumentBit__) \
|
|
((instrumentBit__) & RTI_LOG_BIT_FATAL_ERROR) \
|
|
? RTI_LOG_LEVEL_FATAL_ERROR \
|
|
: ((instrumentBit__) & RTI_LOG_BIT_EXCEPTION) \
|
|
? RTI_LOG_LEVEL_ERROR \
|
|
: ((instrumentBit__) & RTI_LOG_BIT_WARN) \
|
|
? RTI_LOG_LEVEL_WARNING \
|
|
: ((instrumentBit__) & RTI_LOG_BIT_LOCAL) \
|
|
? RTI_LOG_LEVEL_STATUS_LOCAL \
|
|
: ((instrumentBit__) & RTI_LOG_BIT_REMOTE) \
|
|
? RTI_LOG_LEVEL_STATUS_REMOTE \
|
|
: RTI_LOG_LEVEL_DEBUG
|
|
|
|
/*
|
|
* \ingroup RTILogPrintBitmapClass
|
|
* @brief Convert an input RTILogLevel to an string
|
|
*/
|
|
#define RTILogLevel_toString(logLevel__) \
|
|
((logLevel__) == RTI_LOG_LEVEL_FATAL_ERROR \
|
|
? "FATAL" \
|
|
: (logLevel__) == RTI_LOG_LEVEL_ERROR \
|
|
? "ERROR" \
|
|
: (logLevel__) == RTI_LOG_LEVEL_WARNING \
|
|
? "WARNING" \
|
|
: (logLevel__) == RTI_LOG_LEVEL_STATUS_LOCAL \
|
|
? "LOCAL" \
|
|
: (logLevel__) == RTI_LOG_LEVEL_STATUS_REMOTE \
|
|
? "REMOTE" \
|
|
: (logLevel__) == RTI_LOG_LEVEL_DEBUG \
|
|
? "DEBUG" \
|
|
: "")
|
|
|
|
/*e
|
|
* @brief This array implements the correspondence between an RTI Log Level
|
|
* and its associated RTILogBitmap. E.g., if you do
|
|
* RTI_LOG_INSTRUMENT_BIT_FROM_LOG_LEVEL[RTI_LOG_LEVEL_STATUS_LOCAL],
|
|
* you will get RTI_LOG_BIT_LOCAL.
|
|
*/
|
|
extern RTILogDllVariable
|
|
const RTILogBitmap RTI_LOG_INSTRUMENT_BIT_FROM_LOG_LEVEL[RTI_LOG_COUNT_LOG_LEVELS];
|
|
|
|
|
|
/*e
|
|
* @brief Get the instrumentation bit from an RTI Log Level.
|
|
* @pre level__ must be a valid RTI Log Level. If level__ is
|
|
* greater or equal than RTI_LOG_COUNT_LOG_LEVELS, an RTILogBitmap with
|
|
* periodic, activity, content, other, and worker_stat will be returned.
|
|
* @param level__ \b In. The input RTI Log Level.
|
|
* @return The associated instrumentation bit.
|
|
* @note Passing RTI_LOG_LEVEL_DEBUG (or a greater level__) returns a bitmap
|
|
* with periodic, activity, content, other, and worker_stat because all these
|
|
* bits are related to debug information.
|
|
* For debug, the granularity of the bits is larger than the Log Level.
|
|
*/
|
|
#define RTILog_getInstrumentBitFromLogLevel(level__) \
|
|
((RTILogLevel) (level__) >= RTI_LOG_COUNT_LOG_LEVELS \
|
|
? RTI_LOG_BIT_PERIODIC | RTI_LOG_BIT_ACTIVITY \
|
|
| RTI_LOG_BIT_CONTENT | RTI_LOG_BIT_OTHER \
|
|
: RTI_LOG_INSTRUMENT_BIT_FROM_LOG_LEVEL[(level__)])
|
|
|
|
/*=================================================================== */
|
|
/*e \ingroup RTILogNumberBitmapClass
|
|
* \brief Macro to for a number that is specific to the module and submodule.
|
|
* Useful for creating an error code that won't collide with error code
|
|
* from another module/submodule
|
|
*/
|
|
#define RTI_LOG_formSubmoduleSpecificNumber(module, submodule, num) \
|
|
(PRODUCT_WAVEWORKS | (module) | (submodule) | (num))
|
|
|
|
#define RTI_LOG_FAIL_REASON_PRECONDITION \
|
|
RTI_LOG_formSubmoduleSpecificNumber(MODULE_LOG, 0, 0xFF)
|
|
|
|
#define RTI_LOG_FORMAT_1X "0x%08X"
|
|
#define RTI_LOG_FORMAT_2X "0x%08X,0x%08X"
|
|
#define RTI_LOG_FORMAT_3X "0x%08X,0x%08X,0x%08X"
|
|
#define RTI_LOG_FORMAT_4X "0x%08X,0x%08X,0x%08X,0x%08X"
|
|
#define RTI_LOG_FORMAT_5X "0x%08X,0x%08X,0x%08X,0x%08X,0x%08X"
|
|
#define RTI_LOG_FORMAT_9X "0x%08X,0x%08X,0x%08X,0x%08X,0x%08X,0x%08X,0x%08X,0x%08X,0x%08X"
|
|
|
|
#define RTI_LOG_FORMAT_LONG_LONG_1X "0x%08llX"
|
|
|
|
#define RTI_LOG_GUID_PREFIX_FORMAT_XXX RTI_LOG_FORMAT_3X
|
|
#define RTI_LOG_GUID_FORMAT_XXXX RTI_LOG_GUID_PREFIX_FORMAT_XXX ":" RTI_LOG_FORMAT_1X
|
|
#define RTI_LOG_PREFIX_LENGTH 32
|
|
/*e \ingroup RTILogMessageClass
|
|
* \brief Format to print sequence numbers with REDASequenceNumber_expand.
|
|
*/
|
|
#define RTI_LOG_SEQ_NUMBER_FORMAT_du "(%d, %u)"
|
|
|
|
/*e \ingroup RTILogMessageClass
|
|
* \brief Format to print sequence numbers with RTINtpTime_expand.
|
|
*/
|
|
#define RTI_LOG_NTP_TIME_FORMAT_du "(%lld, %u)"
|
|
|
|
#define RTI_LOG_BUFFER_POOL_CREATE_FORMAT_du "(initial number of buffers %d with size %u bytes)"
|
|
|
|
#define RTILogPrintDescriptor const char *
|
|
|
|
/*e
|
|
* \ingroup RTILogMessageClass
|
|
* @brief This special value means that no template was used for printing a log
|
|
* message, so it doesn't have a message ID.
|
|
*/
|
|
#define RTI_LOG_INVALID_MESSAGE_ID 0U
|
|
|
|
/*e
|
|
* \ingroup RTILogMessageClass
|
|
* @brief Facility used for messages logged by users in their applications.
|
|
* We use the Syslog facility slot called "user-level messages" whose value
|
|
* is 1.
|
|
* @attention WARNING: This value is duplicated in LogFacility.java. If you
|
|
* change its value here, make sure you change it there too.
|
|
*/
|
|
#define RTI_LOG_FACILITY_USER 1
|
|
|
|
/*e
|
|
* \ingroup RTILogMessageClass
|
|
* @brief Facility for security events logged using the Security Logging Plugin.
|
|
* We use the Syslog facility slot called "security/authorization messages"
|
|
* whose value is 10.
|
|
* @attention WARNING: This value is duplicated in LogFacility.java. If you
|
|
* change its value here, make sure you change it there too.
|
|
*/
|
|
#define RTI_LOG_FACILITY_SECURITY_EVENT 10
|
|
|
|
/*e
|
|
* \ingroup RTILogMessageClass
|
|
* @brief Facility used for messages coming from an infrastructure service
|
|
* We use the Syslog facility slot called "local use 6" whose value is 22.
|
|
* @attention WARNING: This value is duplicated in LogFacility.java. If you
|
|
* change its value here, make sure you change it there too.
|
|
*/
|
|
#define RTI_LOG_FACILITY_SERVICE 22
|
|
|
|
/*e
|
|
* \ingroup RTILogMessageClass
|
|
* @brief Facility for everything that don't fall in any other facility
|
|
* We use the Syslog facility slot called "local use 7" whose value is 23.
|
|
* @attention WARNING: This value is duplicated in LogFacility.java. If you
|
|
* change its value here, make sure you change it there too.
|
|
*/
|
|
#define RTI_LOG_FACILITY_MIDDLEWARE 23
|
|
|
|
/*e
|
|
* \ingroup RTILogMessageClass
|
|
* The count of Facilities.
|
|
*/
|
|
#define RTI_LOG_FACILITY_COUNT 4
|
|
|
|
/*e \ingroup REDALogClass
|
|
*\brief Special value for the print descriptor parameter, used as a hint to the
|
|
* print functions to let them know we want to print using the compact
|
|
* format.
|
|
*/
|
|
extern RTILogDllVariable
|
|
const char *RTI_LOG_PRINT_DESCRIPTOR_COMPACT_SENTINEL;
|
|
|
|
extern RTILogDllExport
|
|
int RTILogPrintDescriptor_isCompact(RTILogPrintDescriptor printDescriptor);
|
|
|
|
|
|
#define RTILogPrintDescriptor_isCompact(__desc) \
|
|
((__desc) == RTI_LOG_PRINT_DESCRIPTOR_COMPACT_SENTINEL)
|
|
|
|
/******************************************************************************/
|
|
/*e \defgroup RTILogMessageClass RTILogMessage
|
|
\ingroup RTILogModule
|
|
\brief Format strings provide a uniform look and feel to log messages.
|
|
This page contains a collection of common log message format strings.
|
|
|
|
Similar to a \c printf() statement, log messages are generated by using a
|
|
format string and a corresponding list of arguments to compose the actual
|
|
message.
|
|
|
|
For example:
|
|
\code
|
|
|
|
// The name of this test
|
|
const char *METHOD_NAME = "RTINetioIpTester_testBlocked";
|
|
|
|
...
|
|
|
|
// Create a new worker factory
|
|
workerFactory = REDAWorkerFactory_new(WORKER_STORAGE_COUNT_MAX);
|
|
if (workerFactory == NULL) {
|
|
RTITestLog_exception(&RTI_LOG_CREATION_FAILURE_s,
|
|
"workerFactory");
|
|
goto done;
|
|
}
|
|
\endcode
|
|
|
|
will print the following log message in case the worker factory could
|
|
not be created:
|
|
|
|
\code
|
|
RTINetioIpTester_testBlocked: !create workerFactory
|
|
\endcode
|
|
|
|
The format of the second part of the string (after the colon), is
|
|
defined by \ref RTI_LOG_CREATION_FAILURE_s. The _s at the end of the
|
|
format string denotes that using this format string requires a
|
|
single additional string argument (in this case "workerFactory").
|
|
Using \ref RTI_LOG_OS_FAILURE_sXs requires a single string
|
|
followed by a hexadecimal number followed by a single string.
|
|
|
|
The Log module defines a variety of commonly used log message formats,
|
|
as listed on this page.
|
|
The logging interface of other NDDS modules makes use of this common
|
|
set of log message formats.
|
|
|
|
Some examples (all using message format \ref RTI_LOG_CREATION_FAILURE_s):
|
|
|
|
\code
|
|
RTINetioLog_exception(METHOD_NAME, &RTI_LOG_CREATION_FAILURE_s, "socket");
|
|
RTIEventLog_exception(METHOD_NAME, &RTI_LOG_CREATION_FAILURE_s, "parent");
|
|
COMMENDLog_exception(METHOD_NAME, &RTI_LOG_CREATION_FAILURE_s, "destination");
|
|
\endcode
|
|
|
|
Please refer to the Log submodule of an NDDS module for
|
|
more information on the logging interface of that module.
|
|
*/
|
|
/*****************************************************************************/
|
|
|
|
/* \ingroup RTILogModule
|
|
@brief Log interception framework
|
|
|
|
RtiLogOutput Hook diagram:
|
|
|
|
\verbatim
|
|
MODULE_(exception/warn/...)->RTILogMessage_log->RTILogMessage_printWithParams->(RTILog_onMessage->RTILog_onMessageImpl)->(stdout)
|
|
|
|
|
(if RTILog_onMessage has been overwritten by
|
|
RTILog_registerOnMessageMethod, for example, when advLogger is installed)
|
|
|
|
|
V
|
|
RTILog_onMessageAlternativeImplementation
|
|
(e.g., ADVLOGLogger_installedRtiLogMsgLNP) \endverbatim
|
|
|
|
If one hook is set, all hooks in the following () won't be called
|
|
*/
|
|
|
|
/* \ingroup RTILogModule
|
|
* Per module create logging macros following the convention:
|
|
* MODULE as a prefix. (For example: RTIXMLUTILS)
|
|
* Input type: (Message, ParamString, String)
|
|
* Action: (_log, _print, _logWithFunctionName, _logWithParams, _printPlain...)
|
|
*
|
|
* For example:
|
|
* RTIXMLUTILSLogMessage_log()
|
|
* REDALogMessage_log
|
|
*
|
|
* This message type should only be used with the legacy logging macros.
|
|
*/
|
|
struct RTILogMessage {
|
|
/* specifies a number for the log message */
|
|
unsigned int messageId;
|
|
/* specifies the format of the log message */
|
|
const char *format;
|
|
};
|
|
|
|
/* \ingroup RTILogMessageClass
|
|
* @brief Template for log messages.
|
|
* This structure is used to define the format of a log message.
|
|
* It contains a message ID and a format string.
|
|
* The template is used with macros with name MODULELogger_log.
|
|
*
|
|
* This message type exists to trigger warnings when using the legacy log
|
|
* message type (RTILogMessage, used with MODULE_log) with the new logging
|
|
* macros (MODULELogger_log). This type should not be consolidated with
|
|
* RTILogMessage to enable these warnings to be detected.
|
|
*/
|
|
struct RTILogMessageTemplate {
|
|
/* specifies a number for the log message */
|
|
unsigned int messageId;
|
|
/* specifies the format of the log message */
|
|
const char *format;
|
|
};
|
|
|
|
#define RTI_LOG_MSG_SIZE_MAX 1024
|
|
#define RTI_LOG_FORMAT_SIZE_MAX 768
|
|
/* will be truncated if too long: */
|
|
#define RTI_LOG_CONTEXT_FILENAME_LENGTH_MAX 120
|
|
#define RTI_LOG_CONTEXT_METHOD_LENGTH_MAX 80
|
|
|
|
/* \defgroup RTILogPrintBitmapClass RTILogPrintFormatKindMask
|
|
\ingroup RTILogModule
|
|
@brief Bitmaps that controls what gets printed
|
|
RTILogPrintFormatKindMask is composed by RTILogPrintBit.
|
|
*/
|
|
typedef unsigned int RTILogPrintFormatKindMask;
|
|
|
|
/*
|
|
* In this function, logLevel is used for:
|
|
* - Identifying the logged message by its logLevel.
|
|
* - Setting the logged message printFormat.
|
|
*/
|
|
typedef int (*RTILogOnMessageMethod)(
|
|
RTILogPrintFormatKindMask formatMask,
|
|
RTILogLevel logLevel,
|
|
unsigned int moduleId,
|
|
unsigned int messageId,
|
|
RTILogFacility facility,
|
|
const char *msg);
|
|
|
|
extern RTILogDllVariable RTILogOnMessageMethod RTILog_onMessage;
|
|
|
|
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
@brief Print the log number; good for minimal logging
|
|
*/
|
|
#define RTI_LOG_PRINT_BIT_NUMBER 0x1U
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
@brief Print the log message (enabled by default)
|
|
*/
|
|
#define RTI_LOG_PRINT_BIT_MSG 0x2U
|
|
|
|
/* -- Location context bits */
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
@brief Print the calling module (can augment the msg number)
|
|
*/
|
|
#define RTI_LOG_PRINT_BIT_AT_MODULE 0x04U
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
@brief Print filename location
|
|
*/
|
|
#define RTI_LOG_PRINT_BIT_AT_FILE 0x08U
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
@brief Print method location context
|
|
*/
|
|
#define RTI_LOG_PRINT_BIT_AT_METHOD 0x10U
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
@brief Print line number location
|
|
*/
|
|
#define RTI_LOG_PRINT_BIT_AT_LINE 0x20U
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
@brief Log backtrace
|
|
*/
|
|
#define RTI_LOG_PRINT_BIT_BACKTRACE 0x40U
|
|
|
|
#ifdef RTI_BACKTRACE_DISABLED_BY_DEFAULT
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
* @brief For certain architectures (RTI_BACKTRACE_DISABLED_BY_DEFAULT) the
|
|
* backtrace is disabled by default.
|
|
* In case a user using those architectures wants to use the backtrace
|
|
* functionality, they would have to set the this bit
|
|
* (RTI_LOG_PRINT_BIT_FORCE_BACKTRACE) in the printFormat.
|
|
* It will force the enabling of the backtrace.
|
|
*/
|
|
#define RTI_LOG_PRINT_BIT_FORCE_BACKTRACE 0x80U
|
|
#endif
|
|
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
* @brief Print the severity of the message.
|
|
* We need to define log level bit here to
|
|
* use it in the test.1.0 module.
|
|
*/
|
|
#define RTI_LOG_PRINT_BIT_LOG_LEVEL 0x2000U
|
|
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
@brief Use colors
|
|
*/
|
|
#define RTI_LOG_PRINT_COMMON_BIT_COLORIZE 0x10000000U
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
* @brief Override defaults. If set, use the bits 0XXXX XXXX as the default.
|
|
*/
|
|
#define RTI_LOG_PRINT_COMMON_BIT_OVERRIDE_DEFAULT 0x40000000U
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
* @brief Use default. If set, the mask is ignored and the default is used
|
|
* instead.
|
|
*/
|
|
#define RTI_LOG_PRINT_COMMON_BIT_USE_DEFAULT 0x80000000U
|
|
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
@brief Collection of location bits
|
|
*/
|
|
#define RTI_LOG_PRINT_LOCATION_MASK \
|
|
(RTI_LOG_PRINT_BIT_AT_MODULE | RTI_LOG_PRINT_BIT_AT_FILE | \
|
|
RTI_LOG_PRINT_BIT_AT_METHOD | RTI_LOG_PRINT_BIT_AT_LINE)
|
|
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
@brief Default print format for the logger in log.1.0
|
|
*/
|
|
#define RTI_LOG_PRINT_FORMAT_MASK_DEFAULT \
|
|
(RTI_LOG_PRINT_BIT_MSG | RTI_LOG_PRINT_BIT_AT_METHOD)
|
|
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
@brief Default print format for the logger in log.1.0
|
|
*/
|
|
#define RTI_LOG_PRINT_FORMAT_MASK_DEBUG \
|
|
(RTI_LOG_PRINT_BIT_NUMBER \
|
|
| RTI_LOG_PRINT_BIT_MSG \
|
|
| RTI_LOG_PRINT_BIT_AT_FILE \
|
|
| RTI_LOG_PRINT_BIT_AT_LINE \
|
|
| RTI_LOG_PRINT_BIT_AT_MODULE \
|
|
| RTI_LOG_PRINT_BIT_BACKTRACE)
|
|
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
* @brief All the bits for the print format for the logger set to 1.
|
|
*/
|
|
#define RTI_LOG_PRINT_FORMAT_MASK_ALL 0xFFFFFFFFU
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
* @brief All the bits for the print format for the logger set to 0.
|
|
*/
|
|
#define RTI_LOG_PRINT_FORMAT_MASK_NONE 0x00000000U
|
|
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
* @brief All the bits for the location filename print format.
|
|
*/
|
|
#define RTI_LOG_PRINT_FORMAT_MASK_LOCATION_FILELINE \
|
|
(RTI_LOG_PRINT_BIT_AT_FILE \
|
|
| RTI_LOG_PRINT_BIT_AT_LINE)
|
|
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
* @brief All the bits for the location filename and module print format.
|
|
*/
|
|
#define RTI_LOG_PRINT_FORMAT_MASK_LOCATION_FILELINE_AND_MODULE \
|
|
(RTI_LOG_PRINT_FORMAT_MASK_LOCATION_FILELINE \
|
|
| RTI_LOG_PRINT_BIT_AT_MODULE)
|
|
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
* @brief All the bits for the location print format.
|
|
*/
|
|
#define RTI_LOG_PRINT_FORMAT_MASK_LOCATION \
|
|
(RTI_LOG_PRINT_FORMAT_MASK_LOCATION_FILELINE_AND_MODULE \
|
|
| RTI_LOG_PRINT_BIT_AT_METHOD)
|
|
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
* @brief All the bits for the print format for the logger set to 1 except the
|
|
* location one.
|
|
*/
|
|
#define RTI_LOG_PRINT_FORMAT_MASK_ALL_EXCEPT_LOCATION \
|
|
(RTI_LOG_PRINT_FORMAT_MASK_ALL \
|
|
& ~RTI_LOG_PRINT_FORMAT_MASK_LOCATION)
|
|
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
* @brief All the bits for the print format for the logger set to 1 except the
|
|
* location filename.
|
|
*/
|
|
#define RTI_LOG_PRINT_FORMAT_MASK_ALL_EXCEPT_LOCATION_FILELINE \
|
|
(RTI_LOG_PRINT_FORMAT_MASK_ALL \
|
|
& ~RTI_LOG_PRINT_FORMAT_MASK_LOCATION_FILELINE)
|
|
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
* @brief All the bits for the print format for the logger set to 1 except the
|
|
* location filename and module.
|
|
*/
|
|
#define RTI_LOG_PRINT_FORMAT_MASK_ALL_EXCEPT_LOCATION_FILELINE_AND_MODULE \
|
|
(RTI_LOG_PRINT_FORMAT_MASK_ALL \
|
|
& ~RTI_LOG_PRINT_FORMAT_MASK_LOCATION_FILELINE_AND_MODULE)
|
|
|
|
#define RTI_LOG_PRINT_FORMAT_MASK_FATAL_DEFAULT RTI_LOG_PRINT_FORMAT_MASK_DEBUG
|
|
|
|
/*
|
|
* @brief Returns the function name within the current context.
|
|
*/
|
|
#if defined(RTI_WIN32) || defined(RTI_INTIME) || defined(RTI_INTY) || defined(__DCC__)
|
|
#define RTI_FUNCTION_NAME __FUNCTION__
|
|
#else
|
|
#define RTI_FUNCTION_NAME __func__
|
|
#endif
|
|
|
|
/*
|
|
* @brief Returns the line number of the sentence executed within the current
|
|
* context.
|
|
*/
|
|
#define RTI_LINE_NUMBER __LINE__
|
|
|
|
/*
|
|
* @brief Returns the file name associated with the code executed within the
|
|
* current context.
|
|
*/
|
|
#define RTI_FILE_NAME __FILE__
|
|
|
|
/* \ingroup RTILogModule
|
|
* @brief Log the backtrace if the print format bit
|
|
* (RTI_LOG_PRINT_BIT_BACKTRACE) is configured for at least one of the
|
|
* logLevels.
|
|
*
|
|
* Calls RTILog_logBacktrace with the third parameter set to 0 because this
|
|
* function is not called when handling SIGSEGV
|
|
*/
|
|
#define RTILog_logBacktraceIfAvailable() \
|
|
if (RTILog_logBacktrace != NULL \
|
|
&& (RTILog_printMask[RTI_LOG_LEVEL_FATAL_ERROR] \
|
|
& RTI_LOG_PRINT_BIT_BACKTRACE \
|
|
|| RTILog_printMask[RTI_LOG_LEVEL_ERROR] \
|
|
& RTI_LOG_PRINT_BIT_BACKTRACE \
|
|
|| RTILog_printMask[RTI_LOG_LEVEL_WARNING] \
|
|
& RTI_LOG_PRINT_BIT_BACKTRACE \
|
|
|| RTILog_printMask[RTI_LOG_LEVEL_STATUS_LOCAL] \
|
|
& RTI_LOG_PRINT_BIT_BACKTRACE \
|
|
|| RTILog_printMask[RTI_LOG_LEVEL_STATUS_REMOTE] \
|
|
& RTI_LOG_PRINT_BIT_BACKTRACE \
|
|
|| RTILog_printMask[RTI_LOG_LEVEL_DEBUG] \
|
|
& RTI_LOG_PRINT_BIT_BACKTRACE)) { \
|
|
RTILog_logBacktrace( \
|
|
1, \
|
|
RTI_LOG_BACKTRACE_DETAIL_LEVEL_BEST_SPEED, \
|
|
0); \
|
|
}
|
|
|
|
|
|
|
|
#define RTI_LOG_COLOR_RESET "\033[0m"
|
|
#define RTI_LOG_COLOR_BOLD_BLACK "\033[1;30m"
|
|
#define RTI_LOG_COLOR_RED "\033[0;31m"
|
|
#define RTI_LOG_COLOR_GREEN "\033[0;32m"
|
|
#define RTI_LOG_COLOR_YELLOW "\033[0;33m"
|
|
#define RTI_LOG_COLOR_BLUE "\033[0;34m"
|
|
|
|
#define RTILog_setColorFormat(destBuffer, bytesRemaining, colorValue) \
|
|
strncat(destBuffer, colorValue, bytesRemaining)
|
|
|
|
#define RTILog_resetColorFormat(destBuffer, bytesRemaining) \
|
|
RTILog_setColorFormat(destBuffer, bytesRemaining, RTI_LOG_COLOR_RESET)
|
|
|
|
#define RTILog_appendFormatString( \
|
|
destBuffer, \
|
|
availableSize, \
|
|
bufferSize, \
|
|
formatString, \
|
|
setColor, \
|
|
resetColor, \
|
|
colorValue) \
|
|
{ \
|
|
size_t localAvailableSize = availableSize; \
|
|
/* Make sure the format (potentially, with color), fits the buffer */ \
|
|
size_t actualAvailableSize = availableSize; \
|
|
\
|
|
if (setColor) { \
|
|
actualAvailableSize -= strlen(colorValue); \
|
|
} \
|
|
if (resetColor) { \
|
|
actualAvailableSize -= strlen(RTI_LOG_COLOR_RESET); \
|
|
} \
|
|
\
|
|
if (strlen(formatString) <= actualAvailableSize) { \
|
|
if (setColor) { \
|
|
RTILog_setColorFormat(destBuffer, localAvailableSize, colorValue); \
|
|
localAvailableSize = bufferSize - strlen(destBuffer) - 1; \
|
|
} \
|
|
strncat(destBuffer, formatString, localAvailableSize); \
|
|
if (resetColor) { \
|
|
localAvailableSize = bufferSize - strlen(destBuffer) - 1; \
|
|
RTILog_resetColorFormat(destBuffer, localAvailableSize); \
|
|
} \
|
|
} \
|
|
}
|
|
|
|
/*i \ingroup RTILogModule
|
|
* @brief Print a LogMessage without applying any kind of filtering.
|
|
* Main logging function. It is used per module for logging.
|
|
* Used to support all the production logging.
|
|
* It requires a RTILogMessage and a list of params.
|
|
* This function adds metadata for the printFormat. It can be configured by the
|
|
* argument formatMask to filter out selected formats.
|
|
* The instrumentBit represents the logLevel of the message.
|
|
*
|
|
* @param formatMask \b In. Filter out selected formats. Some examples of the
|
|
* masks you can use are:
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_NONE: no printFormat will be applied.
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_ALL: the printFormat set by the user will
|
|
* be applied.
|
|
* @param instrumentBit \b In. It represents the logLevel of the message.
|
|
* It is used to get the printFormat of the logLevel.
|
|
* @param moduleId \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_MODULE.
|
|
* @param filename \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_FILE.
|
|
* @param lineno \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_LINE.
|
|
* @param method \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_METHOD.
|
|
* @param message \b In. It contains the logMessageId and the actual message.
|
|
* @param ... \b In. A list of params of the message.
|
|
*
|
|
* @return The number of bytes printed, excluding NUL, or 0 on error.
|
|
*/
|
|
extern RTILogDllExport
|
|
int RTILogMessage_printWithParams(
|
|
RTILogPrintFormatKindMask formatMask,
|
|
RTILogBitmap instrumentBit,
|
|
unsigned int moduleId,
|
|
const char *filename,
|
|
unsigned int lineno,
|
|
const char *method,
|
|
const struct RTILogMessage *message,
|
|
...);
|
|
|
|
/*i \ingroup RTILogModule
|
|
* @brief Print a LogMessage and parameterized string without applying
|
|
* any kind of filtering.
|
|
* Main logging function to enable category logging. It is used per module
|
|
* for logging.
|
|
* It requires a RTILogMessage, a parameterized string, and a list of params.
|
|
* The RTILogMessage should not accept any params, these are intended to be
|
|
* used by the parameterized string.
|
|
* This function adds metadata for the printFormat. It can be configured by the
|
|
* argument formatMask to filter out selected formats.
|
|
* The instrumentBit represents the logLevel of the message.
|
|
*
|
|
* @param formatMask \b In. Filter out selected formats. Some examples of the
|
|
* masks you can use are:
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_NONE: no printFormat will be applied.
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_ALL: the printFormat set by the user will
|
|
* be applied.
|
|
* @param instrumentBit \b In. It represents the logLevel of the message.
|
|
* It is used to get the printFormat of the logLevel.
|
|
* @param moduleId \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_MODULE.
|
|
* @param filename \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_FILE.
|
|
* @param lineno \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_LINE.
|
|
* @param method \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_METHOD.
|
|
* @param message \b In. It contains the logMessageId and the text to use as a
|
|
* label on the log message. This should not accept any parameters. This label
|
|
* is appended to the beginning of the log message, after the print format.
|
|
* @param parameterizedString \b In. It contains the actual log message.
|
|
* @param ... \b In. A LogMessage and optionally list of params of the message.
|
|
*
|
|
* @return The number of bytes printed, excluding NUL, or 0 on error.
|
|
*/
|
|
extern RTILogDllExport int RTILogMessageParamString_printWithParams(
|
|
RTILogPrintFormatKindMask formatMask,
|
|
RTILogBitmap instrumentBit,
|
|
unsigned int moduleId,
|
|
const char *filename,
|
|
unsigned int lineno,
|
|
const char *method,
|
|
const struct RTILogMessageTemplate *message,
|
|
const char *parameterizedString,
|
|
...) RTI_CHECK_FORMAT_STRING_PARAMETERS(printf, 8, 9);
|
|
|
|
/*i \ingroup RTILogModule
|
|
* @brief Print a LogMessage without applying any kind of filtering.
|
|
* It is the same function than RTILogMessage_printWithParams, however the
|
|
* params are passed va_list.
|
|
*
|
|
* @param formatMask \b In. Filter out selected formats. Some examples of the
|
|
* masks you can use are:
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_NONE: no printFormat will be applied.
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_ALL: the printFormat set by the user will
|
|
* be applied.
|
|
* @param instrumentBit \b In. It represents the logLevel of the message.
|
|
* It is used to get the printFormat of the logLevel.
|
|
* @param moduleId \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_MODULE.
|
|
* @param filename \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_FILE.
|
|
* @param lineno \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_LINE.
|
|
* @param method \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_METHOD.
|
|
* @param message \b In. It contains the logMessageId and the actual message.
|
|
* @ap \b In. A LogMessage and optionally list of params of the message.
|
|
*
|
|
* @return The number of bytes printed, excluding NUL, or 0 on error.
|
|
*/
|
|
extern RTILogDllExport
|
|
int RTILogMessage_vprintWithParams(
|
|
RTILogPrintFormatKindMask formatMask,
|
|
RTILogBitmap instrumentBit,
|
|
unsigned int moduleId,
|
|
const char *filename,
|
|
unsigned int lineno,
|
|
const char *method,
|
|
const struct RTILogMessage *message,
|
|
va_list ap);
|
|
|
|
/*i \ingroup RTILogModule
|
|
* @brief Print a string without applying any kind of filtering.
|
|
*
|
|
* Used to support test logging or printing functionality.
|
|
* It requires a format and a list of params.
|
|
* This function adds metadata for the printFormat. It can be configured by the
|
|
* argument formatMask to filter out selected formats.
|
|
* The instrumentBit represents the logLevel of the message.
|
|
*
|
|
* @param formatMask \b In. Filter out selected formats. Some examples of the
|
|
* masks you can use are:
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_NONE: no printFormat will be applied.
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_ALL: the printFormat set by the user will
|
|
* be applied.
|
|
* @param instrumentBit \b In. It represents the logLevel of the message.
|
|
* It is used to get the printFormat of the logLevel.
|
|
* @param moduleId \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_MODULE.
|
|
* @param filename \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_FILE.
|
|
* @param lineno \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_LINE.
|
|
* @param method \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_METHOD.
|
|
* @param parameterizedString \b In. It is a parameterized string determining
|
|
* the contents of the logged message.
|
|
* @param ... \b In. A parameterized string and optionally list of params of
|
|
* the parameterized string.
|
|
*
|
|
* @return The number of bytes printed, excluding NUL, or 0 on error.
|
|
*/
|
|
extern RTILogDllExport int RTILogParamString_printWithParams(
|
|
RTILogPrintFormatKindMask formatMask,
|
|
RTILogBitmap instrumentBit,
|
|
unsigned int moduleId,
|
|
const char *filename,
|
|
unsigned int lineno,
|
|
const char *method,
|
|
const char *parameterizedString,
|
|
...) RTI_CHECK_FORMAT_STRING_PARAMETERS(printf, 7, 8);
|
|
|
|
/*i \ingroup RTILogClass
|
|
*
|
|
* @brief: Print a string with no limitation on its length.
|
|
*
|
|
* This function adds metadata for the printFormat. It can be configured by the
|
|
* argument formatMask to filter out selected formats.
|
|
* The instrumentBit represents the logLevel of the message.
|
|
*
|
|
* @param formatMask \b In. Filter out selected formats. Some examples of the
|
|
* masks you can use are:
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_NONE: no printFormat will be applied.
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_ALL: the printFormat set by the user will
|
|
* be applied.
|
|
* @param instrumentBit \b In. It represents the logLevel of the message.
|
|
* It is used to get the printFormat of the logLevel.
|
|
* @param moduleId \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_MODULE.
|
|
* @param filename \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_FILE.
|
|
* @param lineno \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_LINE.
|
|
* @param method \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_METHOD.
|
|
* @param string \b In. The string to print
|
|
* @param length \b In. The length of the string (excluding NUL byte)
|
|
*
|
|
* @returns The number of bytes printed, excluding NUL, or 0 on error
|
|
*/
|
|
extern RTILogDllExport
|
|
int RTILogString_printWithParams(
|
|
RTILogPrintFormatKindMask formatMask,
|
|
RTILogBitmap instrumentBit,
|
|
unsigned int moduleId,
|
|
const char *filename,
|
|
unsigned int lineno,
|
|
const char *method,
|
|
const char *string,
|
|
unsigned int length);
|
|
|
|
/*
|
|
* When RTI_LOG_EXTENDED is defined, it enables the support to add the following
|
|
* information to logged messages:
|
|
* - File name (enabled by setting RTI_LOG_PRINT_BIT_AT_FILE)
|
|
* - Line number (enabled by setting RTI_LOG_PRINT_BIT_AT_LINE)
|
|
*
|
|
* RTI_LOG_EXTENDED_DISABLED is defined in specific C files in order to disable
|
|
* the extended logging capabilities for those files. See GMAINT-27
|
|
*/
|
|
#if !defined(RTI_LOG_EXTENDED_DISABLED)
|
|
#define RTI_LOG_EXTENDED
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(RTI_ANDROID)
|
|
#include <android/log.h>
|
|
#define LOG_TAG "RTIConnextLog"
|
|
|
|
/*
|
|
* We need to define a printf because on Android the printf output is not
|
|
* directed to stdout, we have to use __android_log_print instead.
|
|
* We can't just define printf to __android_log_print because this ends up
|
|
* causing a duplicate definition of '__android_log_print' (basically it just
|
|
* does not compile and isn't a good idea to redefine a system call in general
|
|
* anyway).
|
|
*
|
|
* RTILog_printf should only be used in logging device write call
|
|
* implementations to log messages without going through the logging
|
|
* infrastructure.
|
|
*
|
|
* Anywhere else, RTILogParamString_printPlain should be used instead of
|
|
* directly calling printf.
|
|
*/
|
|
#define RTILog_printf(...) \
|
|
__android_log_print( \
|
|
ANDROID_LOG_INFO, \
|
|
LOG_TAG, \
|
|
__VA_ARGS__)
|
|
#else
|
|
#define RTILog_printf(...) printf(__VA_ARGS__)
|
|
#endif
|
|
|
|
/*i \ingroup RTILogModule
|
|
* @brief Print a LogMessage without applying any kind of filtering.
|
|
*
|
|
* Main logging function. It is used per module for logging.
|
|
* Used to support all the production logging.
|
|
* It requires a RTILogMessage and a list of params.
|
|
* This function adds metadata for the printFormat. It can be configured by the
|
|
* argument formatMask to filter out selected formats.
|
|
* The instrumentBit represents the logLevel of the message.
|
|
*
|
|
* @param FORMAT_MASK \b In. Filter out selected formats. Some examples of the
|
|
* masks you can use are:
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_NONE: no printFormat will be applied.
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_ALL: the printFormat set by the user will
|
|
* be applied.
|
|
* @INSTRUMENT_BIT \b In. It represents the logLevel of the message.
|
|
* It is used to get the printFormat of the logLevel.
|
|
* @param MODULE_ID \b In. It is used for the printFormat RTI_LOG_PRINT_BIT_AT_MODULE.
|
|
* @param ... \b In. A LogMessage and optionally list of params of the message.
|
|
*/
|
|
#define RTILogMessage_print( \
|
|
FORMAT_MASK, \
|
|
INSTRUMENT_BIT, \
|
|
MODULE_ID, \
|
|
...) \
|
|
RTILogMessage_printWithParams( \
|
|
(FORMAT_MASK), \
|
|
(INSTRUMENT_BIT), \
|
|
(MODULE_ID), \
|
|
RTI_FILE_NAME, \
|
|
RTI_LINE_NUMBER, \
|
|
RTI_FUNCTION_NAME, \
|
|
__VA_ARGS__)
|
|
|
|
|
|
/*i \ingroup RTILogModule
|
|
* @brief Apply a verbosity filter, then print a LogMessage.
|
|
*
|
|
* Main logging function. It is used per module for logging.
|
|
* Used to support all the production logging.
|
|
* It requires a RTILogMessage and a list of params.
|
|
* This function adds metadata for the printFormat. It can be configured by the
|
|
* argument formatMask to filter out selected formats.
|
|
* The instrumentBit represents the logLevel of the message.
|
|
*
|
|
* @param INSTRUMENT_MASK \b In. It is used to verbosity filter.
|
|
* @param SUBMODULE_MASK \b In. It is used to category filter.
|
|
* @param SUBMODULE_ID \b In. It is used to category filter.
|
|
* @param FORMAT_MASK \b In. Filter out selected formats. Some examples of the
|
|
* masks you can use are:
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_NONE: no printFormat will be applied.
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_ALL: the printFormat set by the user will
|
|
* be applied.
|
|
* @INSTRUMENT_BIT \b In. It represents the logLevel of the message.
|
|
* It is used to get the printFormat of the logLevel.
|
|
* @param MODULE_ID \b In. It is used for the printFormat RTI_LOG_PRINT_BIT_AT_MODULE.
|
|
* @param FILE_NAME \b In. It is used for the printFormat RTI_LOG_PRINT_BIT_AT_FILE.
|
|
* @param LINE_NUMBER \b In. It is used for the printFormat RTI_LOG_PRINT_BIT_AT_LINE.
|
|
* @param FUNCTION_NAME \b In. It is used for the printFormat RTI_LOG_PRINT_BIT_AT_METHOD.
|
|
* @param ... \b In. A LogMessage and optionally list of params of the message.
|
|
*/
|
|
#define RTILogMessage_logWithParams( \
|
|
/* Filtering-only params */ \
|
|
INSTRUMENT_MASK, \
|
|
SUBMODULE_MASK, \
|
|
SUBMODULE_ID, \
|
|
/* Print params */ \
|
|
FORMAT_MASK, \
|
|
INSTRUMENT_BIT, \
|
|
MODULE_ID, \
|
|
FILE_NAME, \
|
|
LINE_NUMBER, \
|
|
FUNCTION_NAME, \
|
|
...) \
|
|
if (((INSTRUMENT_MASK) & (INSTRUMENT_BIT)) \
|
|
&& ((SUBMODULE_MASK) & (SUBMODULE_ID))) \
|
|
RTILogMessage_printWithParams( \
|
|
(FORMAT_MASK), \
|
|
(INSTRUMENT_BIT), \
|
|
(MODULE_ID), \
|
|
(FILE_NAME), \
|
|
(LINE_NUMBER), \
|
|
(FUNCTION_NAME), \
|
|
__VA_ARGS__)
|
|
|
|
/*i \ingroup RTILogModule
|
|
* @brief Apply a verbosity filter, then print a LogMessage.
|
|
*
|
|
* Main logging function. It is used per module for logging.
|
|
* Used to support all the production logging.
|
|
* It requires a RTILogMessage and a list of params.
|
|
* This function adds metadata for the printFormat. It can be configured by the
|
|
* argument formatMask to filter out selected formats.
|
|
* The instrumentBit represents the logLevel of the message.
|
|
*
|
|
* @param INSTRUMENT_MASK \b In. It is used to verbosity filter.
|
|
* @param SUBMODULE_MASK \b In. It is used to category filter.
|
|
* @param SUBMODULE_ID \b In. It is used to category filter.
|
|
* @param FORMAT_MASK \b In. Filter out selected formats. Some examples of the
|
|
* masks you can use are:
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_NONE: no printFormat will be applied.
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_ALL: the printFormat set by the user will
|
|
* be applied.
|
|
* @INSTRUMENT_BIT \b In. It represents the logLevel of the message.
|
|
* It is used to get the printFormat of the logLevel.
|
|
* @param MODULE_ID \b In. It is used for the printFormat RTI_LOG_PRINT_BIT_AT_MODULE.
|
|
* @param ... \b In. A LogMessage and optionally list of params of the message.
|
|
*/
|
|
#define RTILogMessage_log( \
|
|
/* Filtering-only params */ \
|
|
INSTRUMENT_MASK, \
|
|
SUBMODULE_MASK, \
|
|
SUBMODULE_ID, \
|
|
/* Print params */ \
|
|
FORMAT_MASK, \
|
|
INSTRUMENT_BIT, \
|
|
MODULE_ID, \
|
|
...) \
|
|
RTILogMessage_logWithParams( \
|
|
(INSTRUMENT_MASK), \
|
|
(SUBMODULE_MASK), \
|
|
(SUBMODULE_ID), \
|
|
(FORMAT_MASK), \
|
|
(INSTRUMENT_BIT), \
|
|
(MODULE_ID), \
|
|
RTI_FILE_NAME, \
|
|
RTI_LINE_NUMBER, \
|
|
RTI_FUNCTION_NAME, \
|
|
__VA_ARGS__)
|
|
|
|
/*i \ingroup RTILogModule
|
|
* @brief Apply a verbosity filter, then print a LogMessage.
|
|
*
|
|
* It is the same function than RTILogMessage_log however here the
|
|
* method name is not RTI_FUNCTION_NAME and it is passed as argument.
|
|
*
|
|
* @param INSTRUMENT_MASK \b In. It is used to verbosity filter.
|
|
* @param SUBMODULE_MASK \b In. It is used to category filter.
|
|
* @param formatMask \b In. Filter out selected formats. Some examples of the
|
|
* masks you can use are:
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_NONE: no printFormat will be applied.
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_ALL: the printFormat set by the user will
|
|
* be applied.
|
|
* @INSTRUMENT_BIT \b In. It represents the logLevel of the message.
|
|
* It is used to get the printFormat of the logLevel.
|
|
* @param MODULE_ID \b In. It is used for the printFormat RTI_LOG_PRINT_BIT_AT_MODULE.
|
|
* @FUNCTION_NAME \b In. It is used for the printFormat RTI_LOG_PRINT_BIT_AT_METHOD.
|
|
* @param ... \b In. A LogMessage and optionally list of params of the message.
|
|
*/
|
|
#define RTILogMessage_logWithFunctionName( \
|
|
/* Filtering-only params */ \
|
|
INSTRUMENT_MASK, \
|
|
SUBMODULE_MASK, \
|
|
SUBMODULE_ID, \
|
|
/* Print params */ \
|
|
FORMAT_MASK, \
|
|
INSTRUMENT_BIT, \
|
|
MODULE_ID, \
|
|
FUNCTION_NAME, \
|
|
...) \
|
|
RTILogMessage_logWithParams( \
|
|
(INSTRUMENT_MASK), \
|
|
(SUBMODULE_MASK), \
|
|
(SUBMODULE_ID), \
|
|
(FORMAT_MASK), \
|
|
(INSTRUMENT_BIT), \
|
|
(MODULE_ID), \
|
|
RTI_FILE_NAME, \
|
|
RTI_LINE_NUMBER, \
|
|
FUNCTION_NAME, \
|
|
__VA_ARGS__)
|
|
|
|
/*i \ingroup RTILogModule
|
|
* @brief Print an unformatted string without applying any kind of filtering.
|
|
*
|
|
* Used to support test logging or printing functionality.
|
|
* It requires a parametrized string: format and a list of params.
|
|
* The instrumentBit represents the logLevel of the message.
|
|
*
|
|
* Used to support RTILogParamString_logUnformatted. It should not be used in
|
|
* production code because we have better alternatives:
|
|
* - To print unformatted and plain parametrized strings:
|
|
* RTILogParamString_printPlain.
|
|
* - To print formatted parameterized strings:
|
|
* RTILogParamString_print.
|
|
*
|
|
* @param INSTRUMENT_BIT \b In. It represents the logLevel of the message.
|
|
* @param ... \b In. A parameterized string and optionally list of params of
|
|
* the parameterized string.
|
|
*
|
|
* @return The number of bytes printed, excluding NUL, or 0 on error.
|
|
*/
|
|
#define RTILogParamString_printUnformatted( \
|
|
INSTRUMENT_BIT, \
|
|
...) \
|
|
RTILogParamString_printWithParams( \
|
|
RTI_LOG_PRINT_FORMAT_MASK_NONE, \
|
|
(INSTRUMENT_BIT), \
|
|
MODULE_LOG, \
|
|
RTI_FILE_NAME, \
|
|
RTI_LINE_NUMBER, \
|
|
RTI_FUNCTION_NAME, \
|
|
__VA_ARGS__)
|
|
|
|
/*i \ingroup RTILogModule
|
|
* @brief Apply a verbosity filter, then print an unformatted string.
|
|
*
|
|
* Used to support test logging.
|
|
* It requires a parametrized string: format and a list of params.
|
|
* The instrumentBit represents the logLevel of the message.
|
|
*
|
|
* It should not be used in production code because the logged string will lack
|
|
* of a log message id. For verbosity-filtered logging in production code use
|
|
* RTILogMessage logging APIs.
|
|
*
|
|
* @param INSTRUMENT_MASK \b In. It is used to verbosity filter.
|
|
* @param SUBMODULE_MASK \b In. It is used to category filter.
|
|
* @param SUBMODULE_ID \b In. It is used to category filter.
|
|
* @param INSTRUMENT_BIT \b In. It represents the logLevel of the message.
|
|
* @param parameterizedString \b In. It is a parameterized string determining
|
|
* the contents of the logged message.
|
|
* @param ... \b In. A parameterized string and optionally list of params of
|
|
* the parameterized string.
|
|
*/
|
|
#define RTILogParamString_logUnformatted( \
|
|
/* Filtering-only params */ \
|
|
INSTRUMENT_MASK, \
|
|
SUBMODULE_MASK, \
|
|
SUBMODULE_ID, \
|
|
/* Print params */ \
|
|
INSTRUMENT_BIT, \
|
|
...) \
|
|
if (((INSTRUMENT_MASK) & (INSTRUMENT_BIT)) \
|
|
&& ((SUBMODULE_MASK) & (SUBMODULE_ID))) \
|
|
RTILogParamString_printUnformatted( \
|
|
(INSTRUMENT_BIT), \
|
|
__VA_ARGS__)
|
|
|
|
/*i \ingroup RTILogModule
|
|
* @brief Print an unformatted string without applying any kind of filtering.
|
|
*
|
|
* Used to support test logging or printing functionality.
|
|
* It requires a parametrized string: format and a list of params.
|
|
* The logLevel used is NDDS_CONFIG_LOG_LEVEL_DEBUG
|
|
*
|
|
* @param ... \b In. A parameterized string and optionally list of params of
|
|
* the parameterized string.
|
|
*
|
|
* @return The number of bytes printed, excluding NUL, or 0 on error.
|
|
*/
|
|
#define RTILogParamString_printPlain(...) \
|
|
RTILogParamString_printWithParams( \
|
|
RTI_LOG_PRINT_FORMAT_MASK_NONE, \
|
|
RTI_LOG_BITMAP_NONE, \
|
|
MODULE_LOG, \
|
|
RTI_FILE_NAME, \
|
|
RTI_LINE_NUMBER, \
|
|
RTI_FUNCTION_NAME, \
|
|
__VA_ARGS__)
|
|
|
|
/*i \ingroup RTILogModule
|
|
* @brief Apply a verbosity filter, then print a string.
|
|
*
|
|
* Used to support test logging.
|
|
* It requires a parametrized string: format and a list of params.
|
|
* This function adds metadata for the printFormat. It can be configured by the
|
|
* argument formatMask to filter out selected formats.
|
|
* The instrumentBit represents the logLevel of the message.
|
|
*
|
|
* It should not be used in production code because the logged string will lack
|
|
* of a log message id. For verbosity-filtered logging in production code use
|
|
* RTILogMessage logging APIs.
|
|
*
|
|
* @param INSTRUMENT_MASK \b In. It is used to verbosity filter.
|
|
* @param SUBMODULE_MASK \b In. It is used to category filter.
|
|
* @param SUBMODULE_ID \b In. It is used to category filter.
|
|
* @param formatMask \b In. Filter out selected formats. Some examples of the
|
|
* masks you can use are:
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_NONE: no printFormat will be applied.
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_ALL: the printFormat set by the user will
|
|
* be applied.
|
|
* @param INSTRUMENT_BIT \b In. It represents the logLevel of the message.
|
|
* @param MODULE_ID \b In. It is used for the printFormat RTI_LOG_PRINT_BIT_AT_MODULE.
|
|
* @param ... \b In. A parameterized string and optionally list of params of
|
|
* the parameterized string.
|
|
*/
|
|
#define RTILogParamString_log( \
|
|
/* Filtering-only params */ \
|
|
INSTRUMENT_MASK, \
|
|
SUBMODULE_MASK, \
|
|
SUBMODULE_ID, \
|
|
/* Print params */ \
|
|
FORMAT_MASK, \
|
|
INSTRUMENT_BIT, \
|
|
MODULE_ID, \
|
|
...) \
|
|
if (((INSTRUMENT_MASK) & (INSTRUMENT_BIT)) \
|
|
&& ((SUBMODULE_MASK) & (SUBMODULE_ID))) \
|
|
RTILogParamString_printWithParams( \
|
|
(FORMAT_MASK), \
|
|
(INSTRUMENT_BIT), \
|
|
(MODULE_ID), \
|
|
RTI_FILE_NAME, \
|
|
RTI_LINE_NUMBER, \
|
|
RTI_FUNCTION_NAME, \
|
|
__VA_ARGS__)
|
|
|
|
/*i \ingroup RTILogModule
|
|
* @brief Apply a verbosity filter, then print a string.
|
|
*
|
|
* It requires a RTILogMessage and a parameterized string format and a list
|
|
* of params. The RTILogMessage is used as a label and should not accept
|
|
* any params. All params should be used by the parameterized string.
|
|
* This function adds metadata for the printFormat. It can be configured by the
|
|
* argument formatMask to filter out selected formats.
|
|
* The instrumentBit represents the logLevel of the message.
|
|
*
|
|
* @param instrumentMask__ \b In. It is used to verbosity filter.
|
|
* @param submoduleMask__ \b In. It is used to filter by submodule.
|
|
* @param submoduleId__ \b In. It is used to filter by submodule.
|
|
* @param formatMask \b In. Filter out selected formats. Some examples of the
|
|
* masks you can use are:
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_NONE: no printFormat will be applied.
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_ALL: the printFormat set by the user will
|
|
* be applied.
|
|
* @param instrumentBit__ \b In. It represents the logLevel of the message.
|
|
* @param moduleId__ \b In. It is used for the printFormat
|
|
* RTI_LOG_PRINT_BIT_AT_MODULE.
|
|
* @param logMessage__ \b In. It is used to add a label to the log message. It
|
|
* has a unique numeric indetifier to allow for filtering by label
|
|
* rather than by the full message contents).
|
|
* @param ... \b In. A parameterized string and optionally list of params of
|
|
* the parameterized string.
|
|
*/
|
|
#define RTILogMessageParamString_log( \
|
|
/* Filtering-only params */ \
|
|
instrumentMask__, \
|
|
submoduleMask__, \
|
|
submoduleId__, \
|
|
/* Print params */ \
|
|
formatMask__, \
|
|
instrumentBit__, \
|
|
moduleId__, \
|
|
logMessage__, \
|
|
...) \
|
|
if (((instrumentMask__) & (instrumentBit__)) && \
|
|
((submoduleMask__) & (submoduleId__))) \
|
|
RTILogMessageParamString_printWithParams( \
|
|
(formatMask__), \
|
|
(instrumentBit__), \
|
|
(moduleId__), \
|
|
RTI_FILE_NAME, \
|
|
RTI_LINE_NUMBER, \
|
|
RTI_FUNCTION_NAME, \
|
|
(logMessage__), \
|
|
__VA_ARGS__)
|
|
|
|
/*i \ingroup RTILogModule
|
|
* @brief Print a string without applying any kind of filtering.
|
|
*
|
|
* Used to support test logging or printing functionality.
|
|
* It requires a format and a list of params.
|
|
* This function adds metadata for the printFormat. It can be configured by the
|
|
* argument formatMask to filter out selected formats.
|
|
* The instrumentBit represents the logLevel of the message.
|
|
*
|
|
* @param FORMAT_MASK \b In. Filter out selected formats. Some examples of the
|
|
* masks you can use are:
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_NONE: no printFormat will be applied.
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_ALL: the printFormat set by the user will
|
|
* be applied.
|
|
* @param INSTRUMENT_BIT \b In. It represents the logLevel of the message.
|
|
* @param MODULE_ID \b In. It is used for the printFormat RTI_LOG_PRINT_BIT_AT_MODULE.
|
|
* @param ... \b In. A parameterized string and optionally list of params of
|
|
* the parameterized string.
|
|
*
|
|
* @return The number of bytes printed, excluding NUL, or 0 on error.
|
|
*/
|
|
#define RTILogParamString_print( \
|
|
FORMAT_MASK, \
|
|
INSTRUMENT_BIT, \
|
|
MODULE_ID, \
|
|
...) \
|
|
RTILogParamString_printWithParams( \
|
|
(FORMAT_MASK), \
|
|
(INSTRUMENT_BIT), \
|
|
(MODULE_ID), \
|
|
RTI_FILE_NAME, \
|
|
RTI_LINE_NUMBER, \
|
|
RTI_FUNCTION_NAME, \
|
|
__VA_ARGS__)
|
|
|
|
/*i \ingroup RTILogModule
|
|
* @brief Print an unformatted string without applying any kind of filtering.
|
|
* This function is used for printing unbounded strings without format.
|
|
* The logLevel used is NDDS_CONFIG_LOG_LEVEL_DEBUG.
|
|
* Used to support test logging or printing functionality.
|
|
*
|
|
* @param STRING \b In. The string to print
|
|
* @param LENGTH \b In. The length of the string (excluding NUL byte)
|
|
*
|
|
* @return The number of bytes printed, excluding NUL, or 0 on error.
|
|
*/
|
|
#define RTILogString_printPlain(STRING, LENGTH) \
|
|
RTILogString_printWithParams( \
|
|
RTI_LOG_PRINT_FORMAT_MASK_NONE, \
|
|
RTI_LOG_BITMAP_NONE, \
|
|
MODULE_LOG, \
|
|
RTI_FILE_NAME, \
|
|
RTI_LINE_NUMBER, \
|
|
RTI_FUNCTION_NAME, \
|
|
(STRING), \
|
|
(LENGTH))
|
|
|
|
/*i \ingroup RTILogModule
|
|
* @brief Print a string without applying any kind of filtering.
|
|
* This function is used for printing unbounded message.
|
|
* This function adds metadata for the printFormat. It can be configured by the
|
|
* argument formatMask to filter out selected formats.
|
|
* The instrumentBit represents the logLevel of the message.
|
|
* Used to support test logging or printing functionality.
|
|
*
|
|
* @param FORMAT_MASK \b In. Filter out selected formats. Some examples of the
|
|
* masks you can use are:
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_NONE: no printFormat will be applied.
|
|
* - RTI_LOG_PRINT_FORMAT_MASK_ALL: the printFormat set by the user will
|
|
* be applied.
|
|
* @param INSTRUMENT_BIT \b In. It represents the logLevel of the message.
|
|
* @param STRING \b In. The string to print
|
|
* @param LENGTH \b In. The length of the string (excluding NUL byte)
|
|
*
|
|
* @return The number of bytes printed, excluding NUL, or 0 on error.
|
|
*/
|
|
#define RTILogString_print( \
|
|
FORMAT_MASK, \
|
|
INSTRUMENT_BIT, \
|
|
STRING, \
|
|
LENGTH) \
|
|
RTILogString_printWithParams( \
|
|
(FORMAT_MASK), \
|
|
(INSTRUMENT_BIT), \
|
|
MODULE_LOG, \
|
|
RTI_FILE_NAME, \
|
|
RTI_LINE_NUMBER, \
|
|
RTI_FUNCTION_NAME, \
|
|
(STRING), \
|
|
(LENGTH))
|
|
|
|
#ifdef RTI_PRECONDITION_TEST
|
|
#define RTILog_checkPrecondition(MODULE, preconditionExpression, failAction) \
|
|
if (preconditionExpression) { \
|
|
MODULE##Log_logPreconditionFailedWExpr(#preconditionExpression); \
|
|
if (RTILog_g_detectPrecondition) { \
|
|
RTILog_g_preconditionDetected = 1; \
|
|
} \
|
|
RTILog_onAssertBreakpoint(); \
|
|
failAction; \
|
|
}
|
|
|
|
#define RTILog_preconditionOnly(declaration) declaration
|
|
#else /* do nothing */
|
|
#define RTILog_checkPrecondition(MODULE, preconditionExpression, failAction)
|
|
|
|
#define RTILog_preconditionOnly(declaration)
|
|
#endif
|
|
|
|
/*
|
|
* Only in the PURIFY_TEST:
|
|
* - When RTI_startFunction() is called, 1Byte is allocated.
|
|
* - When RTI_return()/RTI_endFunction() is called, we free that 1Byte.
|
|
* We do this to check that functions calling to RTI_startFunction always do a
|
|
* RTI_return for all the return code paths.
|
|
*/
|
|
#ifdef PURIFY_TEST
|
|
#define RTILog_purifyOnlyAlloc() \
|
|
char *__validateStartEndFunction = malloc(1);
|
|
#define RTILog_purifyOnlyFree() \
|
|
if (__validateStartEndFunction != NULL) { \
|
|
free(__validateStartEndFunction); \
|
|
}
|
|
#else
|
|
#define RTILog_purifyOnlyAlloc()
|
|
#define RTILog_purifyOnlyFree()
|
|
#endif
|
|
|
|
/**
|
|
* If PURIFY_TEST is defined: trigger a leak, if not, noop. Useful to track
|
|
* unexpected errors and make valgrind malloc plan to fail and generate a
|
|
* report.
|
|
*/
|
|
#ifdef PURIFY_TEST
|
|
#define RTILog_triggerPurifyOnlyLeak() \
|
|
{ \
|
|
char *__forcedLeakedMemory; \
|
|
__forcedLeakedMemory = malloc(1); \
|
|
(void) __forcedLeakedMemory; \
|
|
} (void) 0
|
|
#else
|
|
#define RTILog_triggerPurifyOnlyLeak() \
|
|
((void) 0)
|
|
#endif
|
|
|
|
/*
|
|
* This macro should be called at the begining of every function,
|
|
* just after all the declaration and just before the other
|
|
* statements.
|
|
*/
|
|
#define RTI_startFunction() \
|
|
RTILog_purifyOnlyAlloc(); \
|
|
/* \
|
|
* RTIOsapiThread_addFunctionToDebugInfo will be executed \
|
|
* if RTI_FUNCTION_HISTORY_SUPPORTED is defined \
|
|
*/ \
|
|
RTIOsapiThread_addFunctionToDebugInfo((void *) RTI_FUNCTION_NAME);
|
|
|
|
/* This macro should be called at the end of every function. */
|
|
#define RTI_endFunction() \
|
|
RTILog_purifyOnlyFree();
|
|
|
|
/* This macro calls RTI_endFunction() and do the "return" action. */
|
|
#define RTI_return(...) \
|
|
RTI_endFunction(); \
|
|
return __VA_ARGS__;
|
|
|
|
#define RTILog_testPrecondition(MODULE, preconditionExpression, failAction) \
|
|
/* \
|
|
* RTIOsapiThread_addFunctionToDebugInfo will be executed \
|
|
* if RTI_FUNCTION_HISTORY_SUPPORTED is defined \
|
|
*/ \
|
|
RTIOsapiThread_addFunctionToDebugInfo((void *) RTI_FUNCTION_NAME); \
|
|
RTILog_checkPrecondition(MODULE, preconditionExpression, failAction)
|
|
|
|
|
|
extern RTILogDllExport void RTILog_flush(void);
|
|
|
|
/*i \ingroup RTILogModule
|
|
@brief Hook for message output method.
|
|
|
|
Use RTILog_registerOnMessageMethod to define an alternate
|
|
implementation of the global function RTILog_onMessage.
|
|
|
|
The default implementation is RTILog_onMessageImpl (which equals
|
|
printf on most OSes, see Log.c).
|
|
*/
|
|
extern RTILogDllExport void
|
|
RTILog_registerOnMessageMethod(RTILogOnMessageMethod onMsgMethod);
|
|
|
|
/*i \ingroup RTILogMessageClass
|
|
\brief Used by ADVLOG to chain to default version of OnMessage
|
|
*/
|
|
extern RTILogDllExport
|
|
RTILogOnMessageMethod RTILog_getDefaultOnMessageMethod(void);
|
|
|
|
/*e \ingroup RTILogMessageClass
|
|
\brief Convenient break point in case things go wrong
|
|
*/
|
|
extern RTILogDllExport int RTILog_onAssertBreakpoint(void);
|
|
|
|
/*============================================================================*/
|
|
/* Logging templates */
|
|
/* IMPORTANT: To avoid duplicates, these should be in alphabetical order.*/
|
|
/*============================================================================*/
|
|
|
|
/*e \ingroup RTILogMessageClass
|
|
* \brief Empty log message prefix used when there is no other appropriate
|
|
* log message prefix.
|
|
* Note: You should be able to justify using this prefix to the
|
|
* Observability team. You should always attempt to create a better log
|
|
* message prefix before using this.
|
|
*/
|
|
/* clang-format off */
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_ADDED_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_ASSERTED_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_ATTACH_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_AUTHENTICATION_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_BIND_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_CREATE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_DELETE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_DEPRECATED_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_DISCOVERY_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_EMPTY_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_ENABLE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FILTER_INCOMPATIBLE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_GET_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_IGNORE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_INCOMPATIBLE_QOS_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_INCONSISTENT_QOS_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_INITIALIZE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_LICENSE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_LIVELINESS_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_MATCH_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_MESSAGE_RECEIVED_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_MODIFY_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_OUT_OF_ORDER_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_OUT_OF_RESOURCES_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_POST_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_PRECONDITION_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_PROCESSING_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_REGISTER_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_REMOVE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_RETURN_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_SAMPLE_LOST_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_SAMPLE_REJECTED_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_SENDING_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_SETTING_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_SUCCESS_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_TEST_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_TYPE_MISMATCH_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_UNDEFINED_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_UNMATCH_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_UNREGISTER_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_UPDATE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_USE_OF_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_USER_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_VALIDATE_TEMPLATE;
|
|
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_BAD_PARAMETER_FAILURE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_CONFIG_FAILURE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_EQUALS_FAILURE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_ADD_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_ALLOCATE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_ASSERT_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_ATTACH_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_AUTHENTICATE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_BIND_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_CLOSE_FILE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_CONVERT_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_CONVERT_TYPE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_COPY_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_CREATE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_DECODE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_DELETE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_DESERIALIZE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_DESTROY_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_DETACH_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_DISABLE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_DISPATCH_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_ENABLE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_ENCODE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_EXECUTE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_FINALIZE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_FIND_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_GET_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_INITIALIZE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_LINK_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_LOAD_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_LOAN_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_LOCK_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_MODIFY_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_MODIFY_READ_WRITE_AREA_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_OPEN_FILE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_PARSE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_POPULATE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_POST_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_PREPARE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_PREPROCESS_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_PRINT_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_PROCESS_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_PUSH_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_REGISTER_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_REMOVE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_RETURN_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_SEND_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_SERIALIZE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_SET_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_SHUTDOWN_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_TRANSFORM_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_UNLOAN_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_UNLOCK_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_UNREGISTER_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_UPDATE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILED_TO_VALIDATE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_FAILURE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_INCONSISTENT_FAILURE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_INSUFFICIENT_SPACE_FAILURE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_LICENSE_FAILURE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_LIBRARY_MISMATCH_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_NOT_SUPPORTED_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_OS_FAILURE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_OUT_OF_RESOURCES_FAILURE_TEMPLATE;
|
|
extern RTILogDllVariable const struct RTILogMessageTemplate RTI_LOG_OVERFLOW_FAILURE_TEMPLATE;
|
|
/* clang-format on */
|
|
|
|
/*******************************************************************************/
|
|
|
|
/* \ingroup RTILogPrintBitmapClass
|
|
@brief Global bitmap for controlling the print format per logLevel
|
|
*/
|
|
extern RTILogDllVariable RTILogPrintFormatKindMask RTILog_printMask[RTI_LOG_COUNT_LOG_LEVELS];
|
|
|
|
/* \ingroup RTILogModule
|
|
@brief Gets print mask of the most common log level (RTI_LOG_LEVEL_ERROR).
|
|
*/
|
|
extern RTILogDllExport RTILogPrintFormatKindMask RTILog_getPrintMask(void);
|
|
|
|
/* \ingroup RTILogModule
|
|
@brief Set print mask for all the log levels, except for
|
|
(RTI_LOG_LEVEL_FATAL_ERROR).
|
|
*/
|
|
extern RTILogDllExport void RTILog_setPrintMask(RTILogPrintFormatKindMask mask);
|
|
|
|
/* \ingroup RTILogModule
|
|
@brief Append print mask for all the log levels, except for
|
|
(RTI_LOG_LEVEL_FATAL_ERROR).
|
|
*/
|
|
extern RTILogDllExport void RTILog_appendPrintMask(RTILogPrintFormatKindMask mask);
|
|
|
|
/* \ingroup RTILogModule
|
|
@brief Set print mask by log level.
|
|
*/
|
|
extern RTILogDllExport void RTILog_setPrintMaskByLogLevel(
|
|
RTILogPrintFormatKindMask mask,
|
|
RTILogLevel logLevel);
|
|
|
|
/* \ingroup RTILogModule
|
|
@brief Get print mask by log level.
|
|
*/
|
|
extern RTILogDllExport RTILogPrintFormatKindMask RTILog_getPrintMaskByLogLevel(RTILogLevel logLevel);
|
|
|
|
/* \ingroup RTILogModule
|
|
* @brief Define the level of detail of the backtrace.
|
|
* - RTI_LOG_BACKTRACE_DETAIL_LEVEL_AUTO is by default BEST_SPEED.
|
|
* - RTI_LOG_BACKTRACE_DETAIL_LEVEL_BEST_SPEED the operation of logging the
|
|
* backtrace is faster but it prodives less details.
|
|
* - RTI_LOG_BACKTRACE_DETAIL_LEVEL_BEST_DETAIL the operation of logging the
|
|
* backtrace is slower but it provides more details.
|
|
*/
|
|
typedef enum {
|
|
RTI_LOG_BACKTRACE_DETAIL_LEVEL_AUTO = 0,
|
|
RTI_LOG_BACKTRACE_DETAIL_LEVEL_BEST_SPEED = 1,
|
|
RTI_LOG_BACKTRACE_DETAIL_LEVEL_BEST_DETAIL = 2
|
|
} RTILogBacktraceDetailLevel;
|
|
|
|
/* \ingroup RTILogModule
|
|
@brief Global function for logging the backtrace.
|
|
*/
|
|
typedef void (*RTILogBacktraceMethod)(
|
|
int index,
|
|
RTILogBacktraceDetailLevel detailLevel,
|
|
int handlingSigsegv);
|
|
extern RTILogDllVariable RTILogBacktraceMethod RTILog_logBacktrace;
|
|
|
|
/* \ingroup RTILogModule
|
|
@brief Global function for adding the method name.
|
|
*/
|
|
typedef void (*RTILogAddToFunctionHistoryMethod)(void *pointerFuncName);
|
|
extern RTILogDllVariable RTILogAddToFunctionHistoryMethod RTILog_addToFunctionHistory;
|
|
|
|
/* \ingroup RTILogModule
|
|
@brief Global function for logging the functionHistory.
|
|
*/
|
|
typedef void (*RTILogFunctionHistoryMethod)(void);
|
|
extern RTILogDllVariable RTILogFunctionHistoryMethod RTILog_logFunctionHistory;
|
|
|
|
/* \ingroup RTILogModule
|
|
@brief Global function for a callback triggered by logging fatal error
|
|
messages.
|
|
*/
|
|
typedef void (*RTILogOnFatalErrorListenerMethod)(void *data);
|
|
extern RTILogDllVariable RTILogOnFatalErrorListenerMethod RTILog_onFatalErrorListenerMethod;
|
|
|
|
/* \ingroup RTILogModule
|
|
@brief When enabled, immediately after a fatal error is logged the
|
|
application is aborted by calling abort().
|
|
*/
|
|
extern RTILogDllVariable int RTILog_abortOnFatalError;
|
|
|
|
/*i \ingroup RTILogModule
|
|
@see RTILog_snprintf
|
|
*/
|
|
extern RTILogDllExport int RTILog_snprintf(
|
|
char *str,
|
|
int size,
|
|
const char *format,
|
|
...) RTI_CHECK_FORMAT_STRING_PARAMETERS(printf, 3, 4);
|
|
|
|
/*i \ingroup RTILogModule
|
|
@brief Register the OnFatalErrorListener method and data.
|
|
@mtsafety This function is thread safe by using two booleans to prevent
|
|
a race condition.
|
|
@param method \b In. The method to set.
|
|
@param data \b In. The data to set.
|
|
|
|
*/
|
|
extern RTILogDllExport
|
|
void RTILog_setOnFatalErrorListener(
|
|
RTILogOnFatalErrorListenerMethod method,
|
|
void *data);
|
|
|
|
/*e @ingroup RTILog
|
|
* @brief Compute the Popcount of a integer value. (get number of enabled bits).
|
|
* @param i \b In. The integer to get number of enabled bits on.
|
|
* @return the number of bits enabled on a 32 bits value.
|
|
*/
|
|
extern RTILogDllExport
|
|
unsigned int RTILog_getEnabledBitCount(unsigned int i);
|
|
|
|
/*******************************************************************************/
|
|
/*i \ingroup RTILogModule
|
|
* @brief These global variables are used to detect if there are preconditions
|
|
* when executing the tests.
|
|
*
|
|
* If there is a precondition and RTILog_g_detectPrecondition is true:
|
|
* RTILog_g_preconditionDetected will be set to true.
|
|
*
|
|
* If RTILog_g_detectPrecondition and RTILog_g_preconditionDetected are true:
|
|
* The unit test will fail and the user will be able to detect the precontion.
|
|
*
|
|
* By default RTILog_g_detectPrecondition is true and it can be configured in
|
|
* two ways:
|
|
* - As an argument of the unit test "-disablePreconditionDetection"
|
|
* - By calling the function RTITestSetting_setDetectPreconditionConfiguration
|
|
* with false.
|
|
*
|
|
* There are no precondition detection between the functions:
|
|
* - RTITestLog_printExpectedErrorsStartEx(true)
|
|
* - RTITestLog_printExpectedErrorsEndEx(true);
|
|
*/
|
|
extern RTILogDllVariable int RTILog_g_preconditionDetected;
|
|
extern RTILogDllVariable int RTILog_g_detectPrecondition;
|
|
|
|
/*******************************************************************************/
|
|
|
|
/*
|
|
* Enable/disable printing backtrace upon receiving sigsegv signal.
|
|
* By default set to true in debug mode or false otherwise.
|
|
* Final value will depend on the value specified in property called
|
|
* PROPERTY_NAME_DDS_PARTICIPANT_ENABLE_BACKTRACE_UPON_SIGSEGV.
|
|
*/
|
|
extern RTILogDllVariable int RTILog_g_enable_backtrace_upon_sigsegv;
|
|
|
|
/******************************************************************************/
|
|
/* Syslog bitmaps and levels definitions */
|
|
/******************************************************************************/
|
|
|
|
/*e
|
|
* @brief A bitmap is an integer of 32 bits.
|
|
* We use this bitmap for representing the syslog verbosity of a log
|
|
* message.
|
|
*/
|
|
typedef unsigned int RTISyslogBitmap;
|
|
|
|
/*e
|
|
* @brief Bit that represent "emergency level" in an RTISyslogBitmap.
|
|
* According to Syslog's definition, emergency means:
|
|
* System is unusable.
|
|
*/
|
|
#define RTI_SYSLOG_BIT_EMERGENCY (0x00000001U)
|
|
|
|
/*e
|
|
* @brief Bit that represent "alert level" in an RTISyslogBitmap.
|
|
* According to Syslog's definition, alert means:
|
|
* Action must be taken immediately.
|
|
*/
|
|
#define RTI_SYSLOG_BIT_ALERT (0x00000001U << 1U)
|
|
|
|
/*e
|
|
* @brief Bit that represent "critical level" in an RTISyslogBitmap.
|
|
* According to Syslog's definition, critical means:
|
|
* Critical conditions.
|
|
*/
|
|
#define RTI_SYSLOG_BIT_CRITICAL (0x00000001U << 2U)
|
|
|
|
/*e
|
|
* @brief Bit that represent "error level" in an RTISyslogBitmap.
|
|
* According to Syslog's definition, error means:
|
|
* Error conditions.
|
|
*/
|
|
#define RTI_SYSLOG_BIT_ERROR (0x00000001U << 3U)
|
|
|
|
/*e
|
|
* @brief Bit that represent "warning level" in an RTISyslogBitmap.
|
|
* According to Syslog's definition, warning means:
|
|
* Warning conditions.
|
|
*/
|
|
#define RTI_SYSLOG_BIT_WARNING (0x00000001U << 4U)
|
|
|
|
/*e
|
|
* @brief Bit that represent "notice level" in an RTISyslogBitmap.
|
|
* According to Syslog's definition, notice means:
|
|
* Normal but significant condition.
|
|
*/
|
|
#define RTI_SYSLOG_BIT_NOTICE (0x00000001U << 5U)
|
|
|
|
/*e
|
|
* @brief Bit that represent "informational level" in an RTISyslogBitmap.
|
|
* According to Syslog's definition, informational means:
|
|
* Informational messages
|
|
*/
|
|
#define RTI_SYSLOG_BIT_INFORMATIONAL (0x00000001U << 6U)
|
|
|
|
/*e
|
|
* @brief Bit that represent "debug level" in an RTISyslogBitmap.
|
|
* According to Syslog's definition, debug means:
|
|
* Debug-level messages.
|
|
*/
|
|
#define RTI_SYSLOG_BIT_DEBUG (0x00000001U << 7U)
|
|
|
|
/*e
|
|
* @brief Bitmap mask with all the syslog bits enabled.
|
|
*/
|
|
#define RTI_SYSLOG_BITMAP_ALL (0xffffffffU)
|
|
|
|
/*e
|
|
* @brief Bitmap mask with no syslog bits enabled.
|
|
*/
|
|
#define RTI_SYSLOG_BITMAP_NONE (0x00000000U)
|
|
|
|
/*e
|
|
* @brief Default syslog bitmap.
|
|
* When using this bitmap, only "errors" will be logged: emergencies, alerts,
|
|
* critical, and errors.
|
|
*/
|
|
#define RTI_SYSLOG_BITMAP_DEFAULT \
|
|
(RTI_SYSLOG_BIT_EMERGENCY | RTI_SYSLOG_BIT_ALERT | RTI_SYSLOG_BIT_CRITICAL \
|
|
| RTI_SYSLOG_BIT_ERROR)
|
|
|
|
/*e
|
|
* @brief The total number of syslog levels.
|
|
*/
|
|
#define RTI_SYSLOG_COUNT_LOG_LEVELS 8
|
|
|
|
|
|
typedef enum {
|
|
/*e
|
|
* @brief Emergency syslog level.
|
|
* System is unusable.
|
|
* @attention Do not modify the value of this element, as this number is
|
|
* part of the syslog RFC.
|
|
*/
|
|
RTI_SYSLOG_LEVEL_EMERGENCY = 0,
|
|
|
|
/*e
|
|
* @brief Alert syslog level.
|
|
* Action must be taken immediately.
|
|
* @attention Do not modify the value of this element, as this number is
|
|
* part of the syslog RFC.
|
|
*/
|
|
RTI_SYSLOG_LEVEL_ALERT = 1,
|
|
|
|
/*e
|
|
* @brief Critical syslog level.
|
|
* Critical conditions.
|
|
* @attention Do not modify the value of this element, as this number is
|
|
* part of the syslog RFC.
|
|
*/
|
|
RTI_SYSLOG_LEVEL_CRITICAL = 2,
|
|
|
|
/*e
|
|
* @brief Error syslog level.
|
|
* Error conditions.
|
|
* @attention Do not modify the value of this element, as this number is
|
|
* part of the syslog RFC.
|
|
*/
|
|
RTI_SYSLOG_LEVEL_ERROR = 3,
|
|
|
|
/*e
|
|
* @brief Warning syslog level.
|
|
* Warning conditions.
|
|
* @attention Do not modify the value of this element, as this number is
|
|
* part of the syslog RFC.
|
|
*/
|
|
RTI_SYSLOG_LEVEL_WARNING = 4,
|
|
|
|
/*e
|
|
* @brief Notice syslog level.
|
|
* Normal but significant condition.
|
|
* @attention Do not modify the value of this element, as this number is
|
|
* part of the syslog RFC.
|
|
*/
|
|
RTI_SYSLOG_LEVEL_NOTICE = 5,
|
|
|
|
/*e
|
|
* @brief Informational syslog level.
|
|
* Informational messages.
|
|
* @attention Do not modify the value of this element, as this number is
|
|
* part of the syslog RFC.
|
|
*/
|
|
RTI_SYSLOG_LEVEL_INFORMATIONAL = 6,
|
|
|
|
/*e
|
|
* @brief Debug syslog level.
|
|
* Debug-level messages.
|
|
* @attention Do not modify the value of this element, as this number is
|
|
* part of the syslog RFC.
|
|
*/
|
|
RTI_SYSLOG_LEVEL_DEBUG = 7
|
|
} RTISyslogLevel;
|
|
|
|
/*e
|
|
* @brief Get the syslog instrumentation bit from a syslog level.
|
|
* @param level \b In. The input syslog level.
|
|
* @return The associated syslog instrumentation bit. If the input level
|
|
* doesn't match any of the existing RTISyslogLevel, RTI_SYSLOG_BIT_DEBUG
|
|
* will be returned.
|
|
*/
|
|
extern RTILogDllExport RTISyslogBitmap
|
|
RTISyslog_getInstrumentBitFromSyslogLevel(RTISyslogLevel level);
|
|
|
|
/*
|
|
* Use this macro at the end of function declarations to warn if the function
|
|
* returns a result that is never used.
|
|
*/
|
|
#ifdef RTI_LINUX
|
|
#define RTI_NODISCARD __attribute__((warn_unused_result))
|
|
#else
|
|
#define RTI_NODISCARD
|
|
#endif
|
|
|
|
/******************************************************************************/
|
|
/* Submodule and instrumentation masks */
|
|
/******************************************************************************/
|
|
|
|
#define RTI_LOG_SUBMODULE_MASK_ALL (0xffffffff)
|
|
|
|
#define RTI_LOG_DECLARE_MODULE_LOG_MASKS(module__) \
|
|
/*i \
|
|
* @brief Stores the current setting for the submodule mask. \
|
|
* \
|
|
* Use <Module>Log_getBitmaps() to set the submodule mask, and \
|
|
* <Module>Log_setBitmaps() to retrieve the current value. \
|
|
*/ \
|
|
extern RTILogDllVariable RTILogBitmap module__ ## Log_g_submoduleMask; \
|
|
/*i \
|
|
* @brief Stores the current setting for the instrumentation mask. \
|
|
* \
|
|
* Use <Module>Log_getBitmaps() to set the instrumentation mask, and \
|
|
* <Module>Log_setBitmaps() to retrieve the current value. \
|
|
*/ \
|
|
extern RTILogDllVariable RTILogBitmap module__ ## Log_g_instrumentationMask; \
|
|
/*i \
|
|
* @brief Gets bitmap for current modules being logged and the \
|
|
* instrumentation being used. \
|
|
* @param submoduleMask enabled submodules specified as a bitmask of \
|
|
* the <Module>_SUBMODULE_MASK. \
|
|
* @param instrumentationMask enabled instrumentation bits \
|
|
* specified as a bitmask comprised of bits defined in RTILogBitmap. \
|
|
*/ \
|
|
extern RTILogDllExport void module__ ## Log_getBitmaps( \
|
|
RTILogBitmap *submoduleMask, \
|
|
RTILogBitmap *instrumentationMask); \
|
|
/*i \
|
|
* @brief Sets a bitmap indicating which submodules to log and the \
|
|
* instrumentation to use. \
|
|
* @param submoduleMask select the submodules using a combination of \
|
|
* SUBMODULE_<Module>_<Name> bits. \
|
|
* @param instrumentationMask select the instrumentation bits to enable \
|
|
* by specifying a combination of bits defined by RTILogBitmap. \
|
|
*/ \
|
|
extern RTILogDllExport void module__ ## Log_setBitmaps( \
|
|
RTILogBitmap submoduleMask, \
|
|
RTILogBitmap instrumentationMask); \
|
|
/*i \
|
|
* @brief Sets the log verbosity, whose legal values range from 0 to 5. \
|
|
* \
|
|
* This is a convenience function that calls <Module>Log_setBitmaps() \
|
|
* internally for the given submoduleMask. \
|
|
* @param submoduleMask select the submodules using a combination of \
|
|
* SUBMODULE_<Module>_<Name> bits. \
|
|
* @param verbosity integer in [0,5]. \
|
|
*/ \
|
|
extern RTILogDllExport void module__ ## Log_setVerbosity( \
|
|
RTILogBitmap submoduleMask, \
|
|
int verbosity); \
|
|
/* \
|
|
* @brief Sets the verbosity of the current module and all modules below \
|
|
* @param verbosity. The submodule mask to be set. \
|
|
*/ \
|
|
extern RTILogDllExport void module__ ## Log_setDependencyInstrumentationMask( \
|
|
RTILogBitmap submoduleMask);
|
|
|
|
/*
|
|
* We exclude RTITest because the functions are needed for the user of the
|
|
* module which it may not be a Connext developer.
|
|
*/
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTIOsapi)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(PROPERTY)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(ADVLOG)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(REDA)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTIClock)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTIXCdr)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTICdr)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(DLDRIVER)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTIEvent)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTIXML)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTIJSON)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(NDDS_Transport_)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTINetio)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(MIG)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(NDDS_WriterHistory_)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(COMMEND)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(PRES)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(DISC)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTINetioCap)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(VERS)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(DDS)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(XMQ)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(METP)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTI_Security_)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTIXMLUTILS)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(APPUTILS)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(NDDS_LBEDiscovery_)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(NDDS_LBPDiscovery_)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTILua)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTITypeUtils)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTI_Monitor_)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTI_Monitoring)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTITLS_)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(NDDS_LBRTPS_)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(NDDS_Transport_TCP_)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(NDDS_ZRTPS_)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTIDDSGEN)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(ROUTER)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(CDS)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(COLLECTORSERVICE)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(PERSISTENCE)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(QUEUE)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RECORDER)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTIWsdds)
|
|
RTI_LOG_DECLARE_MODULE_LOG_MASKS(RTIHTTPS)
|
|
|
|
/*e
|
|
* @brief Set the instrumentation bitmaps for all services
|
|
*
|
|
* @param instrumentationMask \b In. The instrumentation mask to set
|
|
*/
|
|
extern RTILogDllExport
|
|
void RTILog_setServiceBitmap(RTILogBitmap instrumentationMask);
|
|
|
|
/*e
|
|
* @brief Get the instrumentation bitmaps for all services
|
|
*
|
|
* @param instrumentationMask \b Out. The instrumentation mask to get.
|
|
* A bit is enabled if it is enabled in any of the services.
|
|
*/
|
|
extern RTILogDllExport
|
|
void RTILog_getServiceBitmap(RTILogBitmap *instrumentationMask);
|
|
|
|
/*i
|
|
* @brief Instrumentation bitmap for the security event facility.
|
|
*
|
|
* This bitmap is defined in this module so that the APIs
|
|
* NDDS_Config_Logger_get_verbosity_by_category,
|
|
* NDDS_Config_Logger_set_verbosity_by_category,
|
|
* NDDS_Config_Logger_set_verbosity_by_facility,
|
|
* NDDS_Config_Logger_get_verbosity_by_facility can be used to set/get the
|
|
* verbosity for security events.
|
|
*
|
|
* The mask will be used in the API RTI_Security_Logging_log to decide if the
|
|
* security event should be logged or not.
|
|
*
|
|
* This variable should be manipulated using the macros
|
|
* NDDS_Config_Logger_set_security_event_instrumentation_bitmap
|
|
* and NDDS_Config_Logger_get_security_event_instrumentation_bitmap.
|
|
*/
|
|
extern RTILogDllVariable
|
|
RTILogBitmap RTILog_g_securityEventInstrumentationMask;
|
|
|
|
#ifdef __cplusplus
|
|
} /* extern "C" */
|
|
#endif
|
|
|
|
#endif /* log_common_h */
|