ALib C++ Library
by
Library Version:
2402 R1
Documentation generated by
Loading...
Searching...
No Matches
home
dev
A-Worx
ALib
src
alib
alox
macros.inl
Go to the documentation of this file.
1
/** ************************************************************************************************
2
* \file
3
* This header file is part of module \alib_alox of the \aliblong.
4
*
5
* \emoji :copyright: 2013-2024 A-Worx GmbH, Germany.
6
* Published under \ref mainpage_license "Boost Software License".
7
**************************************************************************************************/
8
#ifndef HPP_ALOX_MACROS
9
#define HPP_ALOX_MACROS 1
10
11
#if !defined(HPP_ALIB_ALOX)
12
# error "ALib sources with ending '.inl' must not be included from outside."
13
#endif
14
15
// #################################################################################################
16
// Macros to access the Lox instance
17
// #################################################################################################
18
#if !defined(LOG_LOX)
19
#define LOG_LOX (*alib::lox::Log::Get())
20
#endif
21
22
// #################################################################################################
23
// Macros for setting the source code info prior to executing a log
24
// #################################################################################################
25
#ifdef ALOX_DBG_LOG_CI
26
#define LOG_CI ALIB_CALLER
27
#else
28
#define LOG_CI nullptr, 0, nullptr
29
#endif
30
31
#ifdef ALOX_REL_LOG_CI
32
#define LOX_CI ALIB_CALLER
33
#else
34
#define LOX_CI nullptr, 0, nullptr
35
#endif
36
37
38
#define LOG_ACQUIRE { alib::lox::Lox& _log= LOG_LOX; _log.Acquire( LOG_CI );
39
#define LOG_RELEASE _log.Release(); }
40
#define LOX_ACQUIRE { alib::lox::Lox& _lox= LOX_LOX; _lox.Acquire( LOX_CI );
41
#define LOX_RELEASE _lox.Release(); }
42
43
44
// #################################################################################################
45
// Debug logging macros
46
// #################################################################################################
47
#if ALOX_DBG_LOG
48
#define Log_Prune( ... ) __VA_ARGS__
49
#else
50
#define Log_Prune( ... )
51
#endif
52
53
#define Log_SetSourcePathTrimRule(...) Log_Prune( LOG_ACQUIRE _log.SetSourcePathTrimRule( __VA_ARGS__ ); LOG_RELEASE )
54
#define Log_ClearSourcePathTrimRules(...) Log_Prune( LOG_ACQUIRE _log.ClearSourcePathTrimRules( __VA_ARGS__ ); LOG_RELEASE )
55
#define Log_AddDebugLogger() Log_Prune( LOG_ACQUIRE alib::Log::AddDebugLogger ( &_log ); LOG_RELEASE )
56
#define Log_RemoveDebugLogger() Log_Prune( LOG_ACQUIRE alib::Log::RemoveDebugLogger( &_log ); LOG_RELEASE )
57
#define Log_GetLogger( identifier, name ) Log_Prune( alib::lox::detail::Logger* identifier; \
58
LOG_ACQUIRE identifier= _log.GetLogger( name ); LOG_RELEASE )
59
#define Log_RemoveLogger( logger) Log_Prune( LOG_ACQUIRE _log.RemoveLogger ( logger ); LOG_RELEASE )
60
#define Log_SetDomain(...) Log_Prune( LOG_ACQUIRE _log.SetDomain ( __VA_ARGS__ ); LOG_RELEASE )
61
#define Log_RemoveThreadDomain(...) Log_Prune( LOG_ACQUIRE _log.RemoveThreadDomain( __VA_ARGS__ ); LOG_RELEASE )
62
#define Log_SetDomainSubstitutionRule(...) Log_Prune( LOG_ACQUIRE _log.SetDomainSubstitutionRule( __VA_ARGS__); LOG_RELEASE )
63
#define Log_SetVerbosity(...) Log_Prune( LOG_ACQUIRE _log.SetVerbosity ( __VA_ARGS__ ); LOG_RELEASE )
64
#define Log_SetStartTime( ... ) Log_Prune( LOG_ACQUIRE _log.SetStartTime ( __VA_ARGS__ ); LOG_RELEASE )
65
#define Log_MapThreadName(...) Log_Prune( LOG_ACQUIRE _log.MapThreadName( __VA_ARGS__ ); LOG_RELEASE )
66
#define Log_LogState(...) Log_Prune( LOG_ACQUIRE _log.State ( __VA_ARGS__ ); LOG_RELEASE )
67
#define Log_Verbose(...) Log_Prune( LOG_ACQUIRE _log.Verbose ( __VA_ARGS__ ); LOG_RELEASE )
68
#define Log_Info(...) Log_Prune( LOG_ACQUIRE _log.Info ( __VA_ARGS__ ); LOG_RELEASE )
69
#define Log_Warning(...) Log_Prune( LOG_ACQUIRE _log.Warning ( __VA_ARGS__ ); LOG_RELEASE )
70
#define Log_Error(...) Log_Prune( LOG_ACQUIRE _log.Error ( __VA_ARGS__ ); LOG_RELEASE )
71
#define Log_Assert(...) Log_Prune( LOG_ACQUIRE _log.Assert ( __VA_ARGS__ ); LOG_RELEASE )
72
#define Log_If(...) Log_Prune( LOG_ACQUIRE _log.If ( __VA_ARGS__ ); LOG_RELEASE )
73
#define Log_Once(...) Log_Prune( LOG_ACQUIRE _log.Once ( __VA_ARGS__ ); LOG_RELEASE )
74
#define Log_Entry(...) Log_Prune( LOG_ACQUIRE _log.Entry ( __VA_ARGS__ ); LOG_RELEASE )
75
#define Log_SetPrefix(...) Log_Prune( LOG_ACQUIRE _log.SetPrefix ( __VA_ARGS__ ); LOG_RELEASE )
76
#define Log_Store(...) Log_Prune( LOG_ACQUIRE _log.Store ( __VA_ARGS__ ); LOG_RELEASE )
77
#define Log_Retrieve(data,...) Log_Prune( Box data; LOG_ACQUIRE data= _log.Retrieve( __VA_ARGS__ ); LOG_RELEASE )
78
#define Log_IsActive(result, ...) Log_Prune( LOG_ACQUIRE result= _log.IsActive( __VA_ARGS__ ); LOG_RELEASE )
79
#define Log_Exception(...) Log_Prune( alib::lox::LogTools::Exception( LOG_LOX, __VA_ARGS__ ); )
80
81
82
83
// #################################################################################################
84
// Release logging macros
85
// #################################################################################################
86
#if ALOX_REL_LOG
87
#define Lox_Prune( ... ) __VA_ARGS__
88
#else
89
#define Lox_Prune( ... )
90
#endif
91
92
#define Lox_SetSourcePathTrimRule(...) Lox_Prune( LOX_ACQUIRE _lox.SetSourcePathTrimRule( __VA_ARGS__ ); LOX_RELEASE )
93
#define Lox_ClearSourcePathTrimRules(...) Lox_Prune( LOX_ACQUIRE _lox.ClearSourcePathTrimRules( __VA_ARGS__ ); LOX_RELEASE )
94
#define Lox_GetLogger( identifier, name ) Lox_Prune( alib::lox::detail::Logger* identifier; LOX_ACQUIRE identifier= _lox.GetLogger ( name ); LOX_RELEASE )
95
#define Lox_RemoveLogger( logger ) Lox_Prune( LOX_ACQUIRE _lox.RemoveLogger ( logger ); LOX_RELEASE )
96
#define Lox_SetDomain(...) Lox_Prune( LOX_ACQUIRE _lox.SetDomain (__VA_ARGS__); LOX_RELEASE )
97
#define Lox_RemoveThreadDomain(...) Lox_Prune( LOX_ACQUIRE _lox.RemoveThreadDomain( __VA_ARGS__ ); LOX_RELEASE )
98
#define Lox_SetDomainSubstitutionRule(...) Lox_Prune( LOX_ACQUIRE _lox.SetDomainSubstitutionRule( __VA_ARGS__ ); LOX_RELEASE )
99
#define Lox_SetVerbosity(...) Lox_Prune( LOX_ACQUIRE _lox.SetVerbosity ( __VA_ARGS__ ); LOX_RELEASE )
100
#define Lox_SetStartTime( ... ) Lox_Prune( LOX_ACQUIRE _lox.SetStartTime ( __VA_ARGS__ ); LOX_RELEASE )
101
#define Lox_MapThreadName(...) Lox_Prune( LOX_ACQUIRE _lox.MapThreadName( __VA_ARGS__ ); LOX_RELEASE )
102
#define Lox_LogState(...) Lox_Prune( LOX_ACQUIRE _lox.State ( __VA_ARGS__ ); LOX_RELEASE )
103
#define Lox_Verbose(...) Lox_Prune( LOX_ACQUIRE _lox.Verbose ( __VA_ARGS__ ); LOX_RELEASE )
104
#define Lox_Info(...) Lox_Prune( LOX_ACQUIRE _lox.Info ( __VA_ARGS__ ); LOX_RELEASE )
105
#define Lox_Warning(...) Lox_Prune( LOX_ACQUIRE _lox.Warning ( __VA_ARGS__ ); LOX_RELEASE )
106
#define Lox_Error(...) Lox_Prune( LOX_ACQUIRE _lox.Error ( __VA_ARGS__ ); LOX_RELEASE )
107
#define Lox_Assert(...) Lox_Prune( LOX_ACQUIRE _lox.Assert ( __VA_ARGS__); LOX_RELEASE )
108
#define Lox_If(...) Lox_Prune( LOX_ACQUIRE _lox.If ( __VA_ARGS__); LOX_RELEASE )
109
#define Lox_Once(...) Lox_Prune( LOX_ACQUIRE _lox.Once ( __VA_ARGS__ ); LOX_RELEASE )
110
#define Lox_Entry(...) Lox_Prune( LOX_ACQUIRE _lox.Entry ( __VA_ARGS__ ); LOX_RELEASE )
111
#define Lox_Store(...) Lox_Prune( LOX_ACQUIRE _lox.Store ( __VA_ARGS__ ); LOX_RELEASE )
112
#define Lox_Retrieve(data,...) Lox_Prune( LOX_ACQUIRE LogData* data= _lox.Retrieve( __VA_ARGS__ ); LOX_RELEASE )
113
#define Lox_SetPrefix(...) Lox_Prune( LOX_ACQUIRE _lox.SetPrefix ( __VA_ARGS__ ); LOX_RELEASE )
114
#define Lox_IsActive(result, ...) Lox_Prune( LOX_ACQUIRE result= _lox.IsActive( __VA_ARGS__ ); LOX_RELEASE )
115
#define Lox_Exception(...) Lox_Prune( alib::lox::LogTools::Exception( LOX_LOX, __VA_ARGS__ ); )
116
117
#endif
// HPP_ALOX_MACROS