50 "Instances of class ALox must not be created. Use singleton alib::ALOX" )
58#if !ALOX_DBG_LOG && ALOX_DBG_LOG_CI
59# pragma message ( "Warning: ALox compiler symbol mismatch: ALOX_DBG_LOG_CI is true, while ALOX_DBG_LOG is false." )
61#if !ALOX_REL_LOG && ALOX_REL_LOG_CI
62# pragma message ( "Warning: ALox compiler symbol mismatch: ALOX_REL_LOG_CI is true, while ALOX_REL_LOG is false" )
75 Lox* theDebugLox =
nullptr;
87 for(
auto* it : loxes )
95 Lox* newLox=
new Lox ( name,
false );
96 loxes.EmplaceBack( newLox );
109 if ( lox ==
nullptr )
118 for(
auto search= loxes.begin() ; search != loxes.end() ; ++search )
119 if ( *search == lox )
121 (void) loxes.Erase( search );
124 ALIB_WARNING(
"ALOX",
"Given lox named {!Q} could not be found for removal.",
125 lox !=
nullptr ? lox->
GetName() :
"<null>" )
131 for(
auto* it : loxes )
132 if( it->GetName().Equals<
NC>( lox->
GetName() ) )
134 ALIB_ERROR(
"ALOX",
"Given lox named {!Q} was already registered. Registration ignored.",
138 loxes.EmplaceBack( lox );
157#if !ALIB_RESOURCES_OMIT_DEFAULTS
160 "Var0" ,
A_CHAR(
"1|ALOX/NO_IDE_LOGGER|" "B" ) ,
161 "Var1" ,
A_CHAR(
"2|ALOX/CONSOLE_TYPE|" "S" ) ,
162DOX_MARKER([DOX_CONFIG_REPLACEMENTS1])
163"Var2",
A_CHAR(
"3|ALOX/%2/VERBOSITY_WITH_%1|ALOXV"),
164DOX_MARKER([DOX_CONFIG_REPLACEMENTS1])
165 "Var3" ,
A_CHAR(
"4|ALOX/GLOBAL_SOURCE_PATH_TRIM_RULES|" "S" ) ,
166 "Var4" ,
A_CHAR(
"5|ALOX/%1/SOURCE_PATH_TRIM_RULES|" "S" ) ,
167 "Var5" ,
A_CHAR(
"6|ALOX/%1/DOMAIN_SUBSTITUTION|" "SV;" ) ,
168 "Var6" ,
A_CHAR(
"7|ALOX/%1/PREFIXES|" "S" ) ,
169 "Var7" ,
A_CHAR(
"8|ALOX/%1/DUMP_STATE_ON_EXIT|" "S" ) ,
170 "Var8" ,
A_CHAR(
"20|ALOX/%1/AUTO_SIZES|" "ALOXAS" ) ,
171 "Var9" ,
A_CHAR(
"21|ALOX/%1/FORMAT|" "ALOXFMI" ) ,
172 "Var10",
A_CHAR(
"22|ALOX/%1/FORMAT_DATE_TIME|" "ALOXFDT" ) ,
173 "Var11",
A_CHAR(
"23|ALOX/%1/FORMAT_MULTILINE|" "ALOXFML" ) ,
174 "Var12",
A_CHAR(
"24|ALOX/%1/FORMAT_TIME_DIFF|" "ALOXFTD" ) ,
175 "Var13",
A_CHAR(
"25|ALOX/%1/FORMAT_OTHER|" "ALOXFO" ) ,
176 "Var14",
A_CHAR(
"26|ALOX/%1/REPLACEMENTS|" "ALOXSR" ) ,
177 "Var15",
A_CHAR(
"27|ALOX/CONSOLE_LIGHT_COLORS|" "ALOXCLP" ) ,
178 "Var16",
A_CHAR(
"28|ALOX/CODEPAGE|" "I" ) ,
181 "Var_D1",
A_CHAR(
"false"),
182 "Var_D2",
A_CHAR(
"default"),
183 "Var_D8",
A_CHAR(
"none, verbosity=info, domain=/ALOX"),
188 "Var_D21",
A_CHAR(
"%SF:%SL:%A3%SM %A3[%TC +%TL][%tN][%D]%A1#%# %V: ")
190 "Var_D21",
A_CHAR(
"[%TC +%TL][%tN][%D]%A1#%# %V: ")
192 A_CHAR(
",[ERR],[WRN], ,[***]") ,
196 "Var_D21A",
A_CHAR(
"%SF:%SL:%A3%SM %A3[%TC +%TL][%tN][%D]%A1#%#: %V")
198 "Var_D21A",
A_CHAR(
"[%TC +%TL][%tN][%D]%A1#%#:%V")
200 A_CHAR(
",\033c0,\033c3,,\033c8,\033[0m" ) ,
202 "Var_D22",
A_CHAR(
"yyyy-MM-dd,HH:mm:ss, Days ") ,
203 "Var_D23",
A_CHAR(
"2,ALox: Multi line message follows: ,> ,,nulled,\\r") ,
206 "Var_D24",
A_CHAR(
"1000" ",--- " ", ns" ", \u00B5s" )
207 A_CHAR(
", ms" ", s" ", m" ", h" ", days" ) ,
209 "Var_D25",
A_CHAR(
"---, ---, 3"),
211 "Var_D28",
A_CHAR(
"65001"),
215 "Var_C1",
A_CHAR(
"If true, the creation of an additional, ide-specific debug logger is suppressed." "\n"
216 "(In particular suppresses DebugLogger (C#) and VStudioLogger (C++))" ),
218 "Var_C2",
A_CHAR(
"Influences the type of console logger to be created by method" "\n"
219 "Lox::CreateConsoleLogger which is also used by Log::AddDebugLogger" "\n"
220 "Possible values are: default, plain, ansi, windows, noqtcreator" ),
222 "Var_C3",
A_CHAR(
"The verbosities of logger \"%2\" in lox \"%1\". Supports wildcards for domain paths." "\n"
223 " Format: [ExportAll ;] [[*]domainpath[*] = Verbosity] [;...] " ),
225 "Var_C4",
A_CHAR(
"Defines global source path trim rules (applicable for all Lox instances)." "\n"
226 " Format: [ [*]sourcepath [, inclusion, trimoffset, sensitivity, replacement] ] [;...]" ),
228 "Var_C5",
A_CHAR(
"Defines source path trim rules for Lox \"%1\". " "\n"
229 " Format: [ [*]sourcepath [, inclusion, trimoffset, sensitivity, replacement] ] [;...]" ),
231 "Var_C7",
A_CHAR(
"Prefix strings for log domains of lox \"%1\".\n"
232 " Format: [ [*]domainpath[*] = prefixstring [, inclusion] ] [;...] " ),
234 "Var_C8",
A_CHAR(
"Log information about lox \"%1\" on exit. Comma separated list of arguments define" "\n"
235 "verbosity, domain and content of output. Possible values content arguments are:" "\n"
236 " All, " "Basic, " "Version, " "SPTR, " "Loggers, " "Domains, " "InternalDomains" "\n"
237 " ScopeDomains, " "DSR, " "PrefixLogables" "Once, " "LogData, " "ThreadMappings, " "\n"
238 " CompilationFlags." " If NONE is given nothing is dumped." ),
240 "Var_C20",
A_CHAR(
"Detected field sizes and tabulator positions of the meta-information portion and the " "\n"
241 "those of the log output, separated by ';'. (These is a generated and temporary values)."),
243 "Var_C21",
A_CHAR(
"Meta info format of logger \"%1\", including signatures for verbosity strings and" "\n"
244 "astring added to the end of each log statement." "\n"
245 " Format: MetaInfo,Error,Warning,Info,Verbose,MsgSuffix"),
247 "Var_C22",
A_CHAR(
"Date and time format of logger \"%1\"." "\n"
248 " Format: Date,Time,ElapsedDays"),
250 "Var_C23",
A_CHAR(
"Multi-line format of logger \"%1\"." "\n"
251 " Format: Mode,Headline,Prefix,Suffix,Delimiter,DelimiterReplacement"),
253 "Var_C24",
A_CHAR(
"Time difference entities of logger \"%1\"." "\n"
254 " Format: Minimum,None,Nanos,Micros,Millis,Secs,Mins,Hours, Days"),
256 "Var_C25",
A_CHAR(
"Specifies three further format values: 1. A replacement string if no file name is available, \n"
257 "2. A replacement string if no method name is available and 3. The minimum digits of the\n"
260 "Var_C26",
A_CHAR(
"Pairs of search and replacement strings for text logger \"%1\"." "\n"
261 " Format: [search,replacement] [,...]"),
263 "Var_C27",
A_CHAR(
"Evaluated by colorful loggers that dispose about light and dark colors. Those may adjust" "\n"
264 "their foreground and background color accordingly. If not given, under Windows OS the right" "\n"
265 "value is detected. Otherwise the value defaults to \"foreground\". In some occasions, the" "\n"
266 "(detected or set) runtime environment might also indicate a different default value." "\n"
267 "Possible values are 'Auto', Foreground', 'Background' and 'Never'."),
270 "Var_C28",
A_CHAR(
"Code page used by class WindowsConsoleLogger. Defaults to 65001." "\n"
271 "(Only used on Windows OS)" ),
275 "Verbosity",
A_CHAR(
"0,Verbose,1,"
283 "Scope",
A_CHAR(
"0,Global,1,"
290 "StateInfo",
A_CHAR(
"0" "," "NONE" ",1,"
291 "1" "," "Basic" ",1,"
292 "2" "," "Version" ",1,"
293 "^9" "," "LogData" ",4,"
294 "4" "," "Loggers" ",1,"
296 "8" "," "Domains" ",1,"
297 "^4" "," "InternalDomains" ",1,"
298 "0x100000" "," "SPTR" ",2,"
299 "^5" "," "ScopeDomains" ",1,"
300 "^7" "," "PrefixLogables" ",1,"
301 "^8" "," "Once" ",1,"
302 "^10" "," "ThreadMappings" ",1,"
303 "^21" "," "CompilationFlags" ",1,"
304 "0xFFFFFFFF" "," "All" ",1" ),
306 "LCU",
A_CHAR(
"0,Auto,1,"
314 "VVEA",
A_CHAR(
"ExportAll" ),
315 "TLFmtExc",
A_CHAR(
"\nAn exception occurred during formatting ALox logables:\n" ),
317 "INI_CMT_ALOX",
A_CHAR(
"@>'/// '@HL-Settings controlling ALox log output.\n@HL-"),
319 "INI_CMT_ALOX/LOG",
A_CHAR(
"@>'/// '@HL-Settings of the Lox-instance used with debug-logging.\n@HL-"),
320 "INI_CMT_ALOX/DEBUG_LOGGER",
A_CHAR(
"@>'/// '@HL-Settings of the debug-logger.\n@HL-"),
335DOX_MARKER([DOX_CONFIG_DEFINETYPE3])
343DOX_MARKER([DOX_CONFIG_DEFINETYPE3])
358 ColorfulLoggerParameters::
389 while ( loxes.IsNotEmpty() )
406 ALIB_ASSERT_ERROR(loxes.Count() == 0,
"ALOX",
"A Lox remained from the last test" )
409 new (theDebugLox)
Lox(
"LOG" );
415 while( (startIdx= target.
IndexOf(
'\033', startIdx ) ) >= 0 )
424 if( c ==
'c' || c ==
'C' )
430 case 0: code=
A_CHAR(
"RED") ;
break;
431 case 1: code=
A_CHAR(
"GREEN") ;
break;
432 case 2: code=
A_CHAR(
"YELLOW") ;
break;
433 case 3: code=
A_CHAR(
"BLUE") ;
break;
434 case 4: code=
A_CHAR(
"MAGENTA") ;
break;
435 case 5: code=
A_CHAR(
"CYAN") ;
break;
436 case 6: code=
A_CHAR(
"BLACK") ;
break;
437 case 7: code=
A_CHAR(
"WHITE") ;
break;
438 case 8: code=
A_CHAR(
"GRAY") ;
break;
439 case 9: code=
A_CHAR(
"RESET") ;
break;
440 default: code=
A_CHAR(
"COL_ERR");
break;
450 case 'B': code=
A_CHAR(
"BOLD") ;
break;
451 case 'I': code=
A_CHAR(
"ITALICS") ;
break;
452 case 'r': code=
A_CHAR(
"STYLE_RESET") ;
break;
453 case 'a': code=
A_CHAR(
"RESET") ;
break;
454 default: code=
A_CHAR(
"STYLE_ERR") ;
break;
463 case 'S': code=
A_CHAR(
"URL_START") ;
break;
464 case 'E': code=
A_CHAR(
"URL_END") ;
break;
465 default: code=
A_CHAR(
"URL_ERR") ;
break;
470 else if( c ==
't' && c2 ==
'0' ) code=
A_CHAR(
"TAB");
471 else if( c ==
'A' && c2 ==
'0' ) code=
A_CHAR(
"EOMETA");
474 val.
_<
NC>(code)._(
'}');
483namespace alib {
namespace strings {
487 int pathLevel= UnderlyingIntegral( scope - Scope::Path );
494 target <<
'+' << pathLevel;
497void T_Append<std::pair<Verbosity, Priority>,
nchar, lang::HeapAllocator>::operator()( TAString<nchar, lang::HeapAllocator>& target,
const std::pair<Verbosity, Priority>& src )
500 target._(
'(' )._( src.second );
506namespace alib::config::detail {
511 cvVerbosities.ExportAll=
false;
515 esc.UnescapeTokens(results, src,
A_CHAR(
";"));
516 cvVerbosities.Clear();
517 for(
auto it : results )
521 value.ConsumeChar(
'\r');
522 value.ConsumeCharFromEnd(
'\n');
523 value.ConsumeCharFromEnd(
'\r');
527 cvVerbosities.ExportAll=
true;
530 cvVerbosities.Add( value );
538 if( cvVerbosities.ExportAll)
539 dest << exportAllKeyWord <<
" ;" <<
NEW_LINE;
541 if( !cvVerbosities.IsEmpty())
542 for(
auto it= cvVerbosities.begin() ;; )
544 esc.Escape(*it, dest,
A_CHAR(
";"));
546 if( ++it == cvVerbosities.end() )
NCString ResourceCategory
lang::resources::ResourcePool * resourcePool
config::Configuration * config
const String & GetResource(const NString &name)
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 textlogger::TextLogger * DebugLogger
The debug logger created by AddDebugLogger.
This class acts as a container for Loggers and provides a convenient interface to logging.
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_CONFIG_VARIABLE_REGISTER_TYPE(CPPName)
#define ALIB_BOXING_BOOTSTRAP_VTABLE_DBG_REGISTER(Identifier)
#define ALIB_LOCK_RECURSIVE_WITH(lock)
#define ALIB_ASSERT_ERROR(cond,...)
#define ALIB_BOXING_BOOTSTRAP_REGISTER_FAPPEND_FOR_APPENDABLE_TYPE_N(TAppendable)
#define Log_RemoveDebugLogger()
const T_EnumRecords< TEnum >::Type & GetRecord(TEnum element)
static ALIB_FORCE_INLINE void Destruct(T &object)
@ Exclude
Chooses exclusion.
@ Left
Chooses left alignment.
CreateIfNotExists
Denotes whether something should be created if it does not exist.
@ Yes
Create if something does not exist.
ContainerOp
Denotes standard container operations.
@ Remove
Denotes removals.
ALIB_API MonoAllocator GLOBAL_ALLOCATOR
ALIB_API RecursiveLock GLOBAL_ALLOCATOR_LOCK
ShutdownPhases
Termination levels usable with Bootstrapping ALib Camps.
@ Destruct
The main phase of termination that destructs everything.
lox::ALoxCamp ALOX
The singleton instance of ALib Camp class ALoxCamp.
config::Configuration Configuration
Type alias in namespace alib.
monomem::TLocalAllocator< 4 > LocalAllocator4K
Type alias in namespace alib. Allocates 4kB of stack memory.
BootstrapPhases
Initialization levels usable with Bootstrapping ALib Camps.
@ Final
The final initialization phase. Here, camps are initializing their custom setup.
lox::Scope Scope
Type alias in namespace alib.
constexpr NCString NDEFAULT_WHITESPACES
A zero-terminated string of default whitespace characters.
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
strings::TSubstring< character > Substring
Type alias in namespace alib.
constexpr CString NEW_LINE
A zero-terminated string containing the new-line character sequence.
ALIB_WARNINGS_RESTORE void Bootstrap(int alibVersion, int alibRevision, TCompilationFlags compilationFlags)
characters::character character
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
strings::util::StringEscaper StringEscaper
Type alias in namespace alib.
lox::Lox Lox
Type alias in namespace alib.
characters::nchar nchar
Type alias in namespace alib.
strings::util::TStringVector< character, MonoAllocator > StringVectorMA
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)