ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
macros.inl File Reference

Description:

This header file is part of module ALox of the ALib C++ Library.

© 2013-2024 A-Worx GmbH, Germany. Published under Boost Software License.

Definition in file macros.inl.

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

ALox Low level Macros

The preprocessor macros listed here are the foundation for debug logging and release logging macros introduced below.

Developers that use ALox in standard use cases do not need to know and use the macros listed here.

#define LOG_ACQUIRE   { alib::lox::Lox& _log= LOG_LOX; _log.Acquire( LOG_CI );
 
#define LOG_CI   ALIB_CALLER
 
#define LOG_LOX   (*alib::lox::Log::Get())
 
#define LOG_RELEASE   _log.Release(); }
 
#define LOX_ACQUIRE   { alib::lox::Lox& _lox= LOX_LOX; _lox.Acquire( LOX_CI );
 
#define LOX_CI   ALIB_CALLER
 
#define LOX_RELEASE   _lox.Release(); }
 
ALox Macros For Debug Logging

The macros listed here, are provided to place debug Log Statements within source code using module ALox. Besides that, macros controlling and setting preferences for ALox exists.

The exclusive use of these macros should be sufficient to support most of common debug logging statements with ALox. Should some functionality be not available easily with using the macros, of course, the normal C++ API of ALox can be used in parallel to using the macros. For proper pruning of code that is using the C++ API, such code has to be enclosed by

#if ALOX_DBG_LOG
   ...
   ...
#endif

lines, or embedded in macro Log_Prune.

Note
To be clear: When using the macros, the #if / #endif statements are not needed!

All macro names are prefixed "Log_". This implies that they are macros to implement debug logging. In contrast to this, a set of similar macros exists for release logging (see release logging macros). Those are prefixed "Lox_". (The choice of the prefixes Log_ and Lox provide maximum source code compatibility of ALox for C++ log lines in comparison to ALox for C# and ALox for Java.

Most macros make use of the macro LOG_LOX, which references a singleton object of class Lox that is used for all debug logging. This singleton concept covers most uses cases for debug logging. If more flexibility is wanted, then either macro LOG_LOX might be changed for different compilation units or the ALox for C++ API might be used instead of the macros listed here.

Note
The Scope Domain mechanism of ALox, as well as other ALox functionality which relies on Scopes use the information provided by ALib macro ALIB_CALLER. Changing this macro, might cause these mechanism to fail.
#define Log_AddDebugLogger()
 
#define Log_Assert(...)
 
#define Log_ClearSourcePathTrimRules(...)
 
#define Log_Entry(...)
 
#define Log_Error(...)
 
#define Log_Exception(...)
 
#define Log_GetLogger(identifier, name)
 
#define Log_If(...)
 
#define Log_Info(...)
 
#define Log_IsActive(result, ...)
 
#define Log_LogState(...)
 
#define Log_MapThreadName(...)
 
#define Log_Once(...)
 
#define Log_Prune(...)
 
#define Log_RemoveDebugLogger()
 
#define Log_RemoveLogger(logger)
 
#define Log_RemoveThreadDomain(...)
 
#define Log_Retrieve(data, ...)
 
#define Log_SetDomain(...)
 
#define Log_SetDomainSubstitutionRule(...)
 
#define Log_SetPrefix(...)
 
#define Log_SetSourcePathTrimRule(...)
 
#define Log_SetStartTime(...)
 
#define Log_SetVerbosity(...)
 
#define Log_Store(...)
 
#define Log_Verbose(...)
 
#define Log_Warning(...)
 
ALox Macros For Release Logging

The macros listed here, are provided to place release Log Statements within source code using module ALox. Besides that, macros controlling and setting preferences for ALox exists.

The exclusive use of these macros should be sufficient to support most of common release logging statements with ALox. Should some functionality be not available easily using the macros, of course, the normal C++ API of ALox can be used in parallel to using the macros. Code that is using the C++ API might be enclosed by preprocessor directives

#if ALOX_REL_LOG
   ...
   ...
#endif

to remove them when compiling a release version of the software unit with pruned release log macros. Alternatively, such code might be embedded in macro Lox_Prune. (Pruning of release logging can be enabled by defining compiler symbol ALOX_REL_LOG to 0 and could be useful in certain situations.)

Before using the macros, each code entity has to set the preprocessor macro LOX_LOX This can be done in a general header file of the software, (e.g., the same that exposes the release-Lox object to that source), or, in more complex scenarios with more than one release-Lox object, at any other appropriate source location.

All macro names are prefixed with the term Lox_. This implies that they are macros to implement release logging. In contrast to this, a set of similar macros exists for debug logging (see debug logging macros). Those are prefixed Log_.

Note
The choice of the prefixes Log_ and Lox_ was made to provide maximum source code compatibility of ALox for C++ log lines in comparison to other ALox implementations in other programming languages, which provide a class Log as a kind of 'mirror' class of class Lox. Invocations to class Log get pruned in these languages.

Most macros make use of the macro LOX_LOX, which references a singleton object of class Lox that is used for all release logging. This singleton concept covers most uses cases for release logging. If more flexibility is wanted, then either the macro LOX_LOX might be changed for different compilation units or the ALox C++ API might be used instead of the macros listed here.

#define Lox_Assert(...)
 
#define Lox_ClearSourcePathTrimRules(...)
 
#define Lox_Entry(...)
 
#define Lox_Error(...)
 
#define Lox_Exception(...)
 
#define Lox_GetLogger(identifier, name)
 
#define Lox_If(...)
 
#define Lox_Info(...)
 
#define Lox_IsActive(result, ...)
 
#define Lox_LogState(...)
 
#define Lox_MapThreadName(...)
 
#define Lox_Once(...)
 
#define Lox_Prune(...)
 
#define Lox_RemoveLogger(logger)
 
#define Lox_RemoveThreadDomain(...)
 
#define Lox_Retrieve(data, ...)
 
#define Lox_SetDomain(...)
 
#define Lox_SetDomainSubstitutionRule(...)
 
#define Lox_SetPrefix(...)
 
#define Lox_SetSourcePathTrimRule(...)
 
#define Lox_SetStartTime(...)
 
#define Lox_SetVerbosity(...)
 
#define Lox_Store(...)
 
#define Lox_Verbose(...)
 
#define Lox_Warning(...)