10# if !defined (HPP_ALIB_ALOX)
13# if !defined (HPP_ALIB_CONFIG_INI_FILE)
16# if !defined (HPP_ALOX_DETAIL_LOGGER)
19# if !defined (HPP_ALIB_ALOXMODULE)
23# if !defined (HPP_ALIB_LANG_BASECAMP)
26# if !defined(HPP_ALIB_ENUMS_SERIALIZATION)
29# if !defined (HPP_ALIB_LANG_RESOURCES_RESOURCES)
32# if !defined (HPP_ALIB_ENUMS_RECORDBOOTSTRAP)
35# if !defined (HPP_ALIB_STRINGS_FORMAT)
38# if !defined(HPP_ALIB_CAMP_MESSAGE_REPORT)
63#if ALIB_DEBUG && !defined(ALIB_DOX)
64 namespace {
integer dbgCheckQtyConfigPlugins; }
72 "Instances of class ALox must not be created. Use singleton alib::ALOX" )
80#if !ALOX_DBG_LOG && ALOX_DBG_LOG_CI
81# pragma message ( "Warning: ALox compiler symbol mismatch: ALOX_DBG_LOG_CI is true, while ALOX_DBG_LOG is false." )
83#if !ALOX_REL_LOG && ALOX_REL_LOG_CI
84# pragma message ( "Warning: ALox compiler symbol mismatch: ALOX_REL_LOG_CI is true, while ALOX_REL_LOG is false" )
97 Lox* theDebugLox =
nullptr;
109 for(
auto* it : loxes )
117 Lox* newLox=
new Lox ( name,
false );
118 loxes.EmplaceBack( newLox );
131 if ( lox ==
nullptr )
140 for(
auto search= loxes.begin() ; search != loxes.end() ; ++search )
141 if ( *search == lox )
143 loxes.Erase( search );
146 ALIB_WARNING(
"ALOX",
"Given lox named {!Q} could not be found for removal.",
147 lox !=
nullptr ? lox->
GetName() :
"<null>" )
153 for(
auto* it : loxes )
154 if( it->GetName().Equals<
false>( lox->
GetName() ) )
156 ALIB_ERROR(
"ALOX",
"Given lox named {!Q} was already registered. Registration ignored.",
160 loxes.EmplaceBack( lox );
179#if !ALIB_RESOURCES_OMIT_DEFAULTS
182 "Var0" ,
A_CHAR(
"1|ALOX|NO_IDE_LOGGER|" "||" ) ,
183 "Var1" ,
A_CHAR(
"2|ALOX|CONSOLE_TYPE|" "||" ) ,
184 "Var2" ,
A_CHAR(
"3|ALOX|%1_%2_VERBOSITY|" ";|=|1" ) ,
185 "Var3" ,
A_CHAR(
"4|ALOX|GLOBAL_SOURCE_PATH_TRIM_RULES|" ";|=|1" ) ,
186 "Var4" ,
A_CHAR(
"5|ALOX|%1_SOURCE_PATH_TRIM_RULES|" ";|=|1" ) ,
187 "Var5" ,
A_CHAR(
"6|ALOX|%1_DOMAIN_SUBSTITUTION|" ";|->|1" ) ,
188 "Var6" ,
A_CHAR(
"7|ALOX|%1_PREFIXES|" ";|=|1" ) ,
189 "Var7" ,
A_CHAR(
"8|ALOX|%1_DUMP_STATE_ON_EXIT|" ",||" ) ,
190 "Var8" ,
A_CHAR(
"20|ALOX|%1_AUTO_SIZES|" "||" ) ,
191 "Var9" ,
A_CHAR(
"21|ALOX|%1_FORMAT|" ",||1" ) ,
192 "Var10",
A_CHAR(
"22|ALOX|%1_FORMAT_DATE_TIME|" ",||" ) ,
193 "Var11",
A_CHAR(
"23|ALOX|%1_FORMAT_MULTILINE|" ",||" ) ,
194 "Var12",
A_CHAR(
"24|ALOX|%1_FORMAT_TIME_DIFF|" ",||" ) ,
195 "Var13",
A_CHAR(
"25|ALOX|%1_MAX_ELAPSED_TIME|" ",||" ) ,
196 "Var14",
A_CHAR(
"26|ALOX|%1_REPLACEMENTS|" ",||" ) ,
197 "Var15",
A_CHAR(
"27|ALOX|CONSOLE_LIGHT_COLORS|" "||" ) ,
199 "Var16",
A_CHAR(
"28|ALOX|CODEPAGE|" "||" ) ,
203 "Var_D1",
A_CHAR(
"false"),
204 "Var_D2",
A_CHAR(
"default"),
205 "Var_D3",
A_CHAR(
"writeback"),
206 "Var_D8",
A_CHAR(
"none, verbosity=info, domain=/ALOX"),
208 "Var_D25",
A_CHAR(
"0, limit=59"),
210 "Var_D28",
A_CHAR(
"65001"),
214 "Var_C1",
A_CHAR(
"If true, the creation of an additional, ide-specific debug logger is suppressed." "\n"
215 "(In particular suppresses DebugLogger (C#) and VStudioLogger (C++))" ),
217 "Var_C2",
A_CHAR(
"Influences the type of console logger to be created by method" "\n"
218 "Lox::CreateConsoleLogger which is also used by Log::AddDebugLogger" "\n"
219 "Possible values are: default, plain, ansi, windows, noqtcreator" ),
221 "Var_C3",
A_CHAR(
"The verbosities of logger \"%2\" in lox \"%1\". Use 'writeback [VAR_NAME] ;'" "\n"
222 "to enable automatic writing on application exit." ),
224 "Var_C4",
A_CHAR(
"Defines global source path trim rules (applicable for all Lox instances)." "\n"
225 " Format: [*]sourcepath [, inclusion, trimoffset, sensitivity, replacement] [ ; \u2026 ]" ),
227 "Var_C5",
A_CHAR(
"Defines source path trim rules for Lox \"%1\". " "\n"
228 " Format: [*]sourcepath [, inclusion, trimoffset, sensitivity, replacement] [ ; \u2026 ]" ),
230 "Var_C7",
A_CHAR(
"Prefix strings for log domains of lox \"%1\".\n"
231 " Format: [*]domainpath[*] = prefixstring [, inclusion] [ ; \u2026 ] " ),
233 "Var_C8",
A_CHAR(
"Log information about lox \"%1\" on exit. Comma separated list of arguments define" "\n"
234 "verbosity, domain and content of output. Possible values content arguments are:" "\n"
235 " All, " "Basic, " "Version, " "SPTR, " "Loggers, " "Domains, " "InternalDomains" "\n"
236 " ScopeDomains, " "DSR, " "PrefixLogables" "Once, " "LogData, " "ThreadMappings, " "\n"
237 " CompilationFlags." " If NONE is given nothing is dumped." ),
239 "Var_C20",
A_CHAR(
"Auto size values of last run of Logger '%1' (generated and temporary values)."),
241 "Var_C21",
A_CHAR(
"Meta info format of text logger \"%1\", including signatures for verbosity strings and" "\n"
242 "an optional string added to the end of each log statement." "\n"
243 " Format: metaInfoFormat [, Error [, Warning [, Info [, Verbose [, MsgSuffix ]]]]]"),
245 "Var_C22",
A_CHAR(
"Meta info date and time format of text logger \")%1\"." "\n"
246 " Format: DateFormat [, TimeOfDayFormat [, TimeElapsedDays ]]]"),
248 "Var_C23",
A_CHAR(
"Multi-line format of text logger \"%1\"." "\n"
249 " Format: MultiLineMsgMode [, FmtMultiLineMsgHeadline [, FmtMultiLinePrefix [, FmtMultiLineSuffix\n"
250 " [, MultiLineDelimiter [, MultiLineDelimiterRepl ]]]]]"),
252 "Var_C24",
A_CHAR(
"Meta info time difference entities of text logger \"%1\"." "\n"
253 " Format: TimeDiffMinimum [, TimeDiffNone [, TimeDiffNanos [, TimeDiffMicros [, TimeDiffMillis\n"
254 " [, TimeDiffSecs [, TimeDiffMins [, TimeDiffHours [, TimeDiffDays ]]]]]]]]"),
256 "Var_C25",
A_CHAR(
"Maximum elapsed time of all runs of Logger '%1'. To reset elapsed time display""\n"
257 "width, set this to 0 manually. Generated and temporary value.)" ),
259 "Var_C26",
A_CHAR(
"Pairs of search and replacement strings for text logger \"%1\"." "\n"
260 " Format: search, replacement [, search, replacement] [,...]"),
262 "Var_C27",
A_CHAR(
"Evaluated by colorful loggers that dispose about light and dark colors. Those may" "\n"
263 "adjust their foreground and background color accordingly. If not given, under Windows OS" "\n"
264 "the right value is detected. Otherwise the value defaults to \"foreground\". In some" "\n"
265 "occasions, the (detected or set) runtime environment might also indicate a different" "\n"
266 "default value. Possible values are 'foreground', 'background' and 'never'."),
269 "Var_C28",
A_CHAR(
"Code page used by class WindowsConsoleLogger. Defaults to 65001." "\n"
270 "(Only used on Windows OS)" ),
274 "Verbosity",
A_CHAR(
"0,Verbose,1,"
282 "Scope",
A_CHAR(
"0,Global,1,"
289 "StateInfo",
A_CHAR(
"0" "," "NONE" ",1,"
290 "1" "," "Basic" ",1,"
291 "2" "," "Version" ",1,"
292 "^9" "," "LogData" ",4,"
293 "4" "," "Loggers" ",1,"
295 "8" "," "Domains" ",1,"
296 "^4" "," "InternalDomains" ",1,"
297 "0x100000" "," "SPTR" ",2,"
298 "^5" "," "ScopeDomains" ",1,"
299 "^7" "," "PrefixLogables" ",1,"
300 "^8" "," "Once" ",1,"
301 "^10" "," "ThreadMappings" ",1,"
302 "^21" "," "CompilationFlags" ",1,"
303 "0xFFFFFFFF" "," "All" ",1" ),
305 "LightColorUsage",
A_CHAR(
"0,Auto,1,"
311 "TLFmtExc",
A_CHAR(
"\nAn exception occurred during formatting ALox logables:\n" ),
313 "INI_CMT_ALOX",
A_CHAR(
"@>'/// '@HL-Settings controlling ALox log output.\n@HL-"),
343 theDebugLox= ga.Emplace<
Lox>(
"LOG");
365 while ( loxes.Size() > 0 )
374 Lox(
"trimruleresetlox",
false).
Reset();
383 ALIB_ASSERT_ERROR(loxes.Size() == 0,
"ALOX",
"A Lox remained from the last test" )
385 "ALOX",
"A config plug-in remained from the last test" )
391 new ( theDebugLox)
Lox(
"LOG");
397 while( (startIdx= target.
IndexOf(
'\033', startIdx ) ) >= 0 )
406 if( c ==
'c' || c ==
'C' )
412 case 0: code=
A_CHAR(
"RED") ;
break;
413 case 1: code=
A_CHAR(
"GREEN") ;
break;
414 case 2: code=
A_CHAR(
"YELLOW") ;
break;
415 case 3: code=
A_CHAR(
"BLUE") ;
break;
416 case 4: code=
A_CHAR(
"MAGENTA") ;
break;
417 case 5: code=
A_CHAR(
"CYAN") ;
break;
418 case 6: code=
A_CHAR(
"BLACK") ;
break;
419 case 7: code=
A_CHAR(
"WHITE") ;
break;
420 case 8: code=
A_CHAR(
"GRAY") ;
break;
421 case 9: code=
A_CHAR(
"RESET") ;
break;
422 default: code=
A_CHAR(
"COL_ERR");
break;
432 case 'B': code=
A_CHAR(
"BOLD") ;
break;
433 case 'I': code=
A_CHAR(
"ITALICS") ;
break;
434 case 'r': code=
A_CHAR(
"STYLE_RESET") ;
break;
435 case 'a': code=
A_CHAR(
"RESET") ;
break;
436 default: code=
A_CHAR(
"STYLE_ERR") ;
break;
445 case 'S': code=
A_CHAR(
"URL_START") ;
break;
446 case 'E': code=
A_CHAR(
"URL_END") ;
break;
447 default: code=
A_CHAR(
"URL_ERR") ;
break;
452 else if( c ==
't' && c2 ==
'0' ) code=
A_CHAR(
"TAB");
453 else if( c ==
'A' && c2 ==
'0' ) code=
A_CHAR(
"EOMETA");
456 val.
_<
false>(code)._(
'}');
464#if !defined(ALIB_DOX)
465namespace alib {
namespace strings {
469 int pathLevel= UnderlyingIntegral( scope - Scope::Path );
476 target <<
'+' << pathLevel;
479void T_Append<std::pair<Verbosity, Priorities>,
nchar>::operator()( TAString<nchar>& target,
const std::pair<Verbosity, Priorities>& src )
482 target._(
'(' )._( src.second );
static ALIB_API void AddResourcedSectionComments(Configuration &config, ResourcePool &resourcePool, const NString &resourceCategory, const NString &resourceNamePrefix)
resources::ResourcePool & GetResourcePool()
NCString ResourceCategory
lang::resources::ResourcePool * resourcePool
config::Configuration & GetConfig()
config::Configuration * config
TPlugin * GetPlugin(integer number)
virtual void BootstrapBulk(const nchar *category,...)=0
virtual void bootstrap(BootstrapPhases phase) override
virtual void shutdown(ShutdownPhases phase) override
ALIB_API void Register(Lox *lox, lang::ContainerOp operation)
ALIB_API Lox * Get(const NString &name, lang::CreateIfNotExists create=lang::CreateIfNotExists::No)
static ALIB_API void ReplaceToReadable(AString &target, integer startIdx)
static ALIB_API detail::textlogger::TextLogger * DebugLogger
void Reset(bool reInitialze=true)
const NString & GetName()
TAString & ReplaceSubstring(const TString< TChar > &src, integer regionStart, integer regionLength)
TAString & _(const TString< TChar > &src, integer regionStart, integer regionLength=MAX_LEN)
integer IndexOf(TChar needle, integer startIdx=0) const
TChar CharAt(integer idx) const
#define ALIB_WARNING(...)
#define ALIB_BOXING_VTABLE_DEFINE(TMapped, Identifier)
#define ALIB_BOXING_BOOTSTRAP_VTABLE_DBG_REGISTER(Identifier)
#define ALIB_ASSERT_ERROR(cond,...)
#define ALIB_BOXING_BOOTSTRAP_REGISTER_FAPPEND_FOR_APPENDABLE_TYPE_N(TAppendable)
#define Log_RemoveDebugLogger()
#define ALIB_CALLER_PRUNED
#define ALIB_LOCK_WITH(lock)
const T_EnumRecords< TEnum >::Type & GetRecord(TEnum element)
@ Exclude
Chooses exclusion.
@ Left
Chooses left alignment.
@ Yes
Create if something does not exist.
@ Remove
Denotes removals.
static ALIB_FORCE_INLINE void Destruct(T *object)
ALIB_API ThreadLock GlobalAllocatorLock
void ReleaseGlobalAllocator()
MonoAllocator GlobalAllocator(8 *1024)
MonoAllocator & AcquireGlobalAllocator(const NCString &dbgFile, int dbgLine, const NCString &dbgFunc)
@ Destruct
The main phase of termination that destructs everything.
constexpr NCString NDefaultWhitespaces()
@ PrepareConfig
Initializes up to the creation of a field config .
@ Final
The final initialization phase.
lox::Scope Scope
Type alias in namespace alib.
characters::character character
Type alias in namespace alib.
lox::Lox Lox
Type alias in namespace alib.
characters::nchar nchar
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
static void Bootstrap(TEnum element, TArgs &&... args) noexcept
static ALIB_API void Destruct(Lox *lox)
void operator()(TAString< TChar > &target, const TAppendable &src)