8#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
9# error "Symbol ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
23 module ALib.ALox.Impl;
27 import ALib.Containers.List;
30 import ALib.EnumRecords;
31 import ALib.EnumRecords.Bootstrap;
32 import ALib.Variables;
34 import ALib.Camp.Base;
66 #if ALIB_DEBUG && !ALIB_DEBUG_ASSERTION_PRINTABLES
68 "Instances of class ALox must not be created. Use singleton alib::ALOX" )
92#if !ALOX_DBG_LOG && ALOX_DBG_LOG_CI
93# pragma message ( "Warning: ALox compiler-symbol mismatch: ALOX_DBG_LOG_CI is true, while ALOX_DBG_LOG is false." )
95#if !ALOX_REL_LOG && ALOX_REL_LOG_CI
96# pragma message ( "Warning: ALox compiler-symbol mismatch: ALOX_REL_LOG_CI is true, while ALOX_REL_LOG is false" )
105#if !ALIB_CAMP_OMIT_DEFAULT_RESOURCES
108 "Var0" ,
A_CHAR(
"1|ALOX/NO_IDE_LOGGER|" "B" ) ,
109 "Var1" ,
A_CHAR(
"2|ALOX/CONSOLE_TYPE|" "S" ) ,
110DOX_MARKER([DOX_VARIABLES_REPLACEMENTS1])
111"Var2",
A_CHAR(
"3|ALOX/%2/VERBOSITY_WITH_%1|ALOXV"),
112DOX_MARKER([DOX_VARIABLES_REPLACEMENTS1])
113 "Var3" ,
A_CHAR(
"4|ALOX/GLOBAL_SOURCE_PATH_TRIM_RULES|" "S" ) ,
114 "Var4" ,
A_CHAR(
"5|ALOX/%1/SOURCE_PATH_TRIM_RULES|" "S" ) ,
115 "Var5" ,
A_CHAR(
"6|ALOX/%1/DOMAIN_SUBSTITUTION|" "SV;" ) ,
116 "Var6" ,
A_CHAR(
"7|ALOX/%1/PREFIXES|" "S" ) ,
117 "Var7" ,
A_CHAR(
"8|ALOX/%1/DUMP_STATE_ON_EXIT|" "S" ) ,
118 "Var8" ,
A_CHAR(
"20|ALOX/%1/AUTO_SIZES|" "ALOXAS" ) ,
119 "Var9" ,
A_CHAR(
"21|ALOX/%1/FORMAT|" "ALOXFMI" ) ,
120 "Var10",
A_CHAR(
"22|ALOX/%1/FORMAT_DATE_TIME|" "ALOXFDT" ) ,
121 "Var11",
A_CHAR(
"23|ALOX/%1/FORMAT_MULTILINE|" "ALOXFML" ) ,
122 "Var12",
A_CHAR(
"24|ALOX/%1/FORMAT_TIME_DIFF|" "ALOXFTD" ) ,
123 "Var13",
A_CHAR(
"25|ALOX/%1/FORMAT_OTHER|" "ALOXFO" ) ,
124 "Var14",
A_CHAR(
"26|ALOX/%1/REPLACEMENTS|" "ALOXSR" ) ,
125 "Var15",
A_CHAR(
"27|ALOX/CONSOLE_LIGHT_COLORS|" "ALOXCLP" ) ,
126 "Var16",
A_CHAR(
"28|ALOX/CODEPAGE|" "I" ) ,
129 "Var_D1",
A_CHAR(
"false"),
130 "Var_D2",
A_CHAR(
"default"),
131 "Var_D8",
A_CHAR(
"none, verbosity=info, domain=/ALOX"),
136 "Var_D21",
A_CHAR(
"%SF:%SL:%A3%SM %A3[%TC +%TL][%tN][%D]%A1#%# %V: ")
138 "Var_D21",
A_CHAR(
"[%TC +%TL][%tN][%D]%A1#%# %V: ")
140 A_CHAR(
",[ERR],[WRN], ,[***]") ,
144 "Var_D21A",
A_CHAR(
"%SF:%SL:%A3%SM %A3[%TC +%TL][%tN][%D]%A1#%#: %V")
146 "Var_D21A",
A_CHAR(
"[%TC +%TL][%tN][%D]%A1#%#:%V")
148 A_CHAR(
",\033c0,\033c3,,\033c8,\033[0m" ) ,
150 "Var_D22",
A_CHAR(
"yyyy-MM-dd,HH:mm:ss, Days ") ,
151 "Var_D23",
A_CHAR(
"2,ALox: Multi-line message follows: ,> ,,nulled,\\r") ,
154 "Var_D24",
A_CHAR(
"1000" ",--- " ", ns" ", \u00B5s" )
155 A_CHAR(
", ms" ", s" ", m" ", h" ", days" ) ,
157 "Var_D25",
A_CHAR(
"---, ---, 3"),
159 "Var_D28",
A_CHAR(
"65001"),
163 "Var_C1",
A_CHAR(
"If true, the creation of an additional, ide-specific debug logger is suppressed." "\n"
164 "(In particular suppresses DebugLogger (C#) and VStudioLogger (C++))" ),
166 "Var_C2",
A_CHAR(
"Influences the type of console logger to be created by method" "\n"
167 "Lox::CreateConsoleLogger which is also used by Log::AddDebugLogger" "\n"
168 "Possible values are: default, plain, ansi, windows, noqtcreator" ),
170 "Var_C3",
A_CHAR(
"The verbosities of logger \"%2\" in lox \"%1\". Supports wildcards for domain paths." "\n"
171 " Format: [ExportAll ;] [[*]domainpath[*] = Verbosity] [;...] " ),
173 "Var_C4",
A_CHAR(
"Defines global source path trim rules (applicable for all Lox instances)." "\n"
174 " Format: [ [*]sourcepath [, inclusion, trimoffset, sensitivity, replacement] ] [;...]" ),
176 "Var_C5",
A_CHAR(
"Defines source path trim rules for Lox \"%1\". " "\n"
177 " Format: [ [*]sourcepath [, inclusion, trimoffset, sensitivity, replacement] ] [;...]" ),
179 "Var_C7",
A_CHAR(
"Prefix strings for log domains of lox \"%1\".\n"
180 " Format: [ [*]domainpath[*] = prefixstring [, inclusion] ] [;...] " ),
182 "Var_C8",
A_CHAR(
"Log information about lox \"%1\" on exit. Comma separated list of arguments define" "\n"
183 "verbosity, domain and content of output. Possible values content arguments are:" "\n"
184 " All, " "Basic, " "Version, " "SPTR, " "Loggers, " "Domains, " "InternalDomains" "\n"
185 " ScopeDomains, " "DSR, " "PrefixLogables" "Once, " "LogData, " "ThreadMappings, " "\n"
186 " CompilationFlags." " If NONE is given nothing is dumped." ),
188 "Var_C20",
A_CHAR(
"Detected field sizes and tabulator positions of the meta-information portion and the " "\n"
189 "those of the log output, separated by ';'. (These is a generated and temporary values)."),
191 "Var_C21",
A_CHAR(
"Meta info format of logger \"%1\", including signatures for verbosity strings and" "\n"
192 "astring added to the end of each log statement." "\n"
193 " Format: MetaInfo,Error,Warning,Info,Verbose,MsgSuffix"),
195 "Var_C22",
A_CHAR(
"Date and time format of logger \"%1\"." "\n"
196 " Format: Date,Time,ElapsedDays"),
198 "Var_C23",
A_CHAR(
"Multi-line format of logger \"%1\"." "\n"
199 " Format: Mode,Headline,Prefix,Suffix,Delimiter,DelimiterReplacement"),
201 "Var_C24",
A_CHAR(
"Time difference entities of logger \"%1\"." "\n"
202 " Format: Minimum,None,Nanos,Micros,Millis,Secs,Mins,Hours, Days"),
204 "Var_C25",
A_CHAR(
"Specifies three further format values: 1. A replacement string if no file name is available, \n"
205 "2. A replacement string if no method name is available and 3. The minimum digits of the\n"
208 "Var_C26",
A_CHAR(
"Pairs of search and replacement strings for text logger \"%1\"." "\n"
209 " Format: [search,replacement] [,...]"),
211 "Var_C27",
A_CHAR(
"Evaluated by colorful loggers that dispose of light and dark colors. Those may adjust" "\n"
212 "their foreground and background color accordingly. If not given, under Windows OS the right" "\n"
213 "value is detected. Otherwise the value defaults to \"foreground\". In some occasions, the" "\n"
214 "(detected or set) runtime environment might also indicate a different default value." "\n"
215 "Possible values are 'Auto', Foreground', 'Background' and 'Never'."),
218 "Var_C28",
A_CHAR(
"Code page used by class WindowsConsoleLogger. Defaults to 65001." "\n"
219 "(Only used on Windows OS)" ),
223 "Verbosity",
A_CHAR(
"0,Verbose,1,"
231 "Scope",
A_CHAR(
"0,Global,1,"
238 "StateInfo",
A_CHAR(
"0" "," "NONE" ",1,"
239 "1" "," "Basic" ",1,"
240 "2" "," "Version" ",1,"
241 "^9" "," "LogData" ",4,"
242 "4" "," "Loggers" ",1,"
244 "8" "," "Domains" ",1,"
245 "^4" "," "InternalDomains" ",1,"
246 "0x100000" "," "SPTR" ",2,"
247 "^5" "," "ScopeDomains" ",1,"
248 "^7" "," "PrefixLogables" ",1,"
249 "^8" "," "Once" ",1,"
250 "^10" "," "ThreadMappings" ",1,"
251 "^21" "," "CompilationFlags" ",1,"
252 "0xFFFFFFFF" "," "All" ",1" ),
254 "LCU",
A_CHAR(
"0,Auto,1,"
262 "VVEA",
A_CHAR(
"ExportAll" ),
263 "TLFmtExc",
A_CHAR(
"\nAn exception occurred during formatting ALox logables:\n" ),
265 "INI_CMT_ALOX",
A_CHAR(
"@>'/// '@HL-Settings controlling ALox log output.\n@HL-"),
267 "INI_CMT_ALOX/LOG",
A_CHAR(
"@>'/// '@HL-Settings of the Lox-instance used with debug-logging.\n@HL-"),
268 "INI_CMT_ALOX/DEBUG_LOGGER",
A_CHAR(
"@>'/// '@HL-Settings of the debug-logger.\n@HL-"),
277DOX_MARKER([DOX_VARIABLES_DEFINETYPE3])
284DOX_MARKER([DOX_VARIABLES_DEFINETYPE3])
299 ColorfulLoggerParameters::
300 LightColorUsage >( *
this,
"LCU" );
335namespace alib {
namespace strings {
339 int pathLevel= int( scope - Scope::Path );
346 target <<
'+' << pathLevel;
352 target._(
'(' )._( src.Second );
361 auto& cvVerbosities= data->As<alib::lox::CVVerbosities>();
363 cvVerbosities.ExportAll=
false;
367 esc.UnescapeTokens(results, src,
A_CHAR(
";"));
368 cvVerbosities.Clear();
369 for(
auto& it : results ) {
372 value.ConsumeChar(
'\r');
373 value.ConsumeCharFromEnd(
'\n');
374 value.ConsumeCharFromEnd(
'\r');
377 cvVerbosities.ExportAll=
true;
380 cvVerbosities.Add( value );
385 auto& cvVerbosities= data->As<alib::lox::CVVerbosities>();
387 if( cvVerbosities.ExportAll)
388 dest << exportAllKeyWord <<
" ;" <<
NEW_LINE;
390 if( !cvVerbosities.IsEmpty())
391 for(
auto it= cvVerbosities.begin() ;; ) {
392 esc.Escape(*it, dest,
A_CHAR(
";"));
394 if( ++it == cvVerbosities.end() )
NCString ResourceCategory
BootstrapPhases GetBootstrapState()
SharedConfiguration config
Camp(const NCString &resourceCategory)
SPResourcePool resourcePool
const String & GetResource(const NString &name)
virtual void Bootstrap() override
Implementation of Camp::Bootstrap.
virtual void Shutdown(ShutdownPhases phase) override
static ALIB_DLL textlogger::TextLogger * DebugLogger
The debug logger created by AddDebugLogger.
This class acts as a container for Loggers and provides a convenient interface to logging.
#define ALIB_VARIABLES_REGISTER_TYPE(CPPName)
#define Log_RemoveDebugLogger()
#define ALIB_ASSERT_ERROR(cond, domain,...)
void Bootstrap(camp::Camp &camp, const NString &name, character innerDelim=',', character outerDelim=',')
const RecordsTraits< TEnum >::Type & GetRecord(TEnum element)
@ Left
Chooses left alignment.
@ Exclude
Chooses exclusion.
void shutdownLoxes()
Internal lox management.
ALIB_DLL TMonoAllocator< lang::HeapAllocator > GLOBAL_ALLOCATOR
strings::util::StringEscaper StringEscaper
Type alias in namespace alib.
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
@ Final
The final initialization phase. Here, camps are initializing their custom setup.
lox::Scope Scope
Type alias in namespace alib.
strings::util::TStringVector< character, MonoAllocator > StringVectorMA
Type alias in namespace alib.
constexpr CString NEW_LINE
A zero-terminated string containing the new-line character sequence.
variables::Configuration Configuration
Type alias in namespace alib.
ShutdownPhases
Termination levels usable with Bootstrapping ALib Camps.
@ Destruct
The main phase of termination that destructs everything.
strings::TAString< nchar, lang::HeapAllocator > NAString
Type alias in namespace alib.
boxing::Pair< T, U > Pair
Type alias in namespace alib.
characters::nchar nchar
Type alias in namespace alib.
lox::ALoxCamp ALOX
The singleton instance of ALib Camp class ALoxCamp.
constexpr NCString NDEFAULT_WHITESPACES
A zero-terminated string of default whitespace characters.
lox::Lox Lox
Type alias in namespace alib.
strings::TField< nchar > NField
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
monomem::TLocalAllocator< 4 > LocalAllocator4K
Type alias in namespace alib. Allocates 4kB of stack memory.
strings::TSubstring< character > Substring
Type alias in namespace alib.
void operator()(TAString< TChar > &target, const TAppendable &src)