Trough the use of camp module ALib Configuration of the ALib C++ Library, external configuration variables can be comfortably defined and accessed.
While this is a reference appendix chapter, for general information, please refer to:
A few further configuration variables that ALib internally uses are defined by module ALib BaseCamp. The variables defined with that module are documented here.
Default Behavior:
ALox and the ALib C++ Library are designed to run fine without setting configuration variables, because all of them have resourced default values. Therefore, these variables provide an additional way to tweak ALox and change its default behavior.
Declaration:
The variables listed here are resourced with camp ALox and declared with enum class lox::Variables.
Type: "S"
(AStringPA) Default Value: "default"
Influences the type of console logger that will be created by method Lox::CreateConsoleLogger, which is also used by Log::AddDebugLogger.
Possible values are:
Default | No influence, same as if variable was not set (An OS-specific, colorful logger is chosen). |
Plain | Plain text Logger of type ConsoleLogger is created. |
Ansi | A Logger of type AnsiLogger is created. |
Windows | A Logger of type WindowsConsoleLogger is created. |
Type: "ALOXCLP"
(ColorfulLoggerParameters) Default Value: "Auto"
Evaluated by colorful loggers that dispose about light and dark colors to adjust their foreground color accordingly. E.g., for instances of class AnsiLogger, field CFP is set.
If not given, under Windows OS the right value is detected (here, the color of a terminal is detectable). Otherwise the value defaults to be an empty string, which chooses a programmatically evaluated (internal) default value. In some occasions the (detected or set) runtime environment might influence such default value.
Value options are:
Type: "B"
(boolean) Default Value: "false"
Boolean variable that is evaluated in method Log::AddDebugLogger. If not set, when debugging, an additional Logger supporting the log output of the IDE is created. The only logger currently available (needed) is with WindowsOS / VisualStudio, class VStudioLogger.
This variable can be used to suppress this.
Type: "I"
(integral) Default Value: 65001
Availability: On target platform WindowsOS only.
Evaluated once in the constructor of class WindowsConsoleLogger. Overwrites the default value of field CodePage. For possible values refer to [Microsoft documentation] (https://msdn.microsoft.com/EN-US/library/windows/desktop/dd317756%28v=vs.85%29.aspx).
Type: "ALOXAS"
(FormatAutoSizes) Default Value: none.
Format: ALOX/<LOGGERNAME>/AUTO_SIZES = [!] [ T|F Actual[,session] ] [/ T|F Actual[,session] ] [; [!] [ T|F Actual[,session] ] [/ T|F Actual[,session] ] ]
While the format definition above looks rather complicated, in fact it is just two optional exports auf the contained AutoSizes objects, separated by a semicolon ';'
.
This variable is used by Loggers derived from abstract type TextLogger. It is read when a TextLogger is registered with a Lox.
This mechanism maintains automatically adjusted tabulator positions in the generated meta information across different runs of a software.
Note that the portion 'LOGGERNAME'
in the variable name is replaced by ALox with the value of Logger::GetName. This allows having different sizes for different Loggers.
Consider this variable a 'cookie' that ALox uses to store tabulator widths which automatically increase as needed, across sessions.
The value of the variable can be retrieved with TextLogger::GetAutoSizes. If a certain set auf sizes is to be used and never changed, then flags AutoSizes::WriteProtected can be set in one or both AutoSizes instances of this variable. The flag will also be set by the logger, if the configuration variable becomes defined with a priority higher than Priority::Session.
Type: "ALOXFMI"
(FormatMetaInfo) Default Value: "%SF:%SL:%A3%SM %A3[%TC +%TL][%tN][%D]%A1#%# %V: ,[ERR],[WRN], ,[***]"
.
This variable is used by Loggers derived of type textlogger::TextLogger.
It is read when a Logger of that type is added to a Lox and if found, fields
of struct FormatMetaInfo are set according to the variables' content. The contents of the variable is specified as follows:
Format: ALOX/<LOGGERNAME>/FORMAT = ["]Format["] [, ["]Error["] [, ["]Warning["] [, ["]Info["] [, ["]Verbose["] ] [, ["]MsgSuffix["] ]]]]]
Values that start or end with whitespace characters or which contain comma characters (,
) , need to be enclosed by quotation marks ("
).
Note that the portion 'LOGGERNAME'
in the variable name is replaced by ALox as follows:
This allows configuring either a single Logger or a whole class of Loggers.
As a sample, configuration variable ALOX/ANSI_CONSOLE_LOGGER/FORMAT, affects all loggers of type AnsiConsoleLogger as long as no specific name is set when such Logger is constructed and no separate configuration for that name is set.
Note that the default debug Logger which is automatically created if no Logger is attached to the debug Lox singleton, is named "DEBUG_LOGGER"
. Therefore, by setting variable ALOX/DEBUG_LOGGER/FORMAT
, this Logger is affected. Furthermore, with debugging, a second debug-Logger for the IDE might be created (depending on the platform and IDE used). Its' name is "IDE_LOGGER"
.
Type: "ALOXFDT"
(FormatDateTime) Default Value: "yyyy-MM-dd,HH:mm:ss, Days "
.
This variable is used and applied in the same way as ALOX/LOGGERNAME/FORMAT and the fields of struct FormatDateTime:
Type: "ALOXFTD"
(FormatTimeDiff) Default Value: "1000,--- , ns, \\u00B5s, ms, s, m, h, days"
.
This variable is used and applied in the same way as ALOX/LOGGERNAME/FORMAT and the fields of struct FormatTimeDiff:
Type: "ALOXFML"
(FormatMultiLine) Default Value: "2,ALox: Multi line message follows: ,> ,,nulled,\\r"
.
This variable is used and applied in the same way as ALOX/LOGGERNAME/FORMAT and the fields of struct FormatMultiLine:
Type: "ALOXFO"
(FormatOther) Default Value: "---, ---, 3"
.
This variable is used and applied in the same way as ALOX/LOGGERNAME/FORMAT and defines the fields of struct FormatOther:
Type: "SV;"
(StringVectorSemicolon) Default Value: none.
This variable is used to set Verbosities for a Logger attached to an instance of class Lox. The portions 'LOGGERNAME'
and 'LOXNAME'
of the variable name have to be replaced by the names of the instances of Lox and Logger in question.
Format: ALOX/<LOGGERNAME>/VERBOSITY_WITH_<LOXNAME> = [ExportAll ;] [*]domainpath[*] = verbosity [ ; … ]
Details are described in chapter 13.4 Variable LOXNAME_LOGGERNAME_VERBOSITY of the Programmer's Manual.
Type: "S"
(AStringPA) Format: ALOX/<LOGGERNAME>/REPLACEMENTSFORMAT = , ["]search["]=["]replace["] [, ...]
Note that the portion 'LOGGERNAME'
in the variable name is replaced as documented in ALOX/LOGGERNAME/FORMAT.
The variable allows setting pairs of search and replace strings for a text logger. Pairs found here, are set using method TextLogger::SetReplacement.
Values that start or end with whitespace characters or which contain comma characters (,
), need to be enclosed by quotation marks ("
).
Type: "SV;"
(StringVectorSemicolon) Default Value: none.
This variable is used to define Domain Substitution Rules for a Lox. The portion 'LOXNAME'
of the variable name has to be replaced by the name of the instance of class Lox in question.
Format: ALOX/<LOXNAME>/DOMAIN_SUBSTITUTION = [*]domainpath[*] -> replacement [ ; … ]
Details are described in Substitution Rules and External Configuration.
Type: "S"
(AStringPA) Default Value: ""
(empty string).
This variable is used to define global Source Path Trim Rules.
Format: ALOX/GLOBAL_SOURCE_PATH_TRIM_RULES = [*]sourcepath [, inclusion, trimoffset, sensitivity, replacement] [ ; … ]
Details are described in External Configuration of Trim Rules.
Type: "S"
(AStringPA) Default Value: ""
(empty string).
This variable is used to define Lox-specific Source Path Trim Rules. The portion 'LOXNAME'
of the variable name has to be replaced by the name of the instance of class Lox in question.
Format: ALOX/<LOXNAME>/SOURCE_PATH_TRIM_RULES = [*]sourcepath [, inclusion, trimoffset, sensitivity, replacement] [ ; … ]
Details are described in External Configuration of Trim Rules.
Type: "S"
(AStringPA) Default Value: ""
(empty string).
This variable is used to define Lox and Log Domain specific Prefix Logables (strings only). The portion 'LOXNAME'
of the variable name has to be replaced by the name of the instance of class Lox in question.
Format: ALOX/<LOXNAME>/PREFIXES = [*]domainpath[*] = prefixstring [, inclusion] [ ; … ]
The variable value may contain more than one definition, separated by semicolons ';'. Each definition contains of the following parameters:
Type: "S"
(AStringPA) Default Value: "none, verbosity=info, domain=/ALOX"
(empty string).
Used for debugging or for investigation into ALox enabled 3rd party libraries or applications.
Format: ALOX/<LOXNAME>/DUMP_STATE_ON_EXIT = arg1 [, arg2][, … ]
The portion 'LOXNAME'
of the variable name has to be replaced by the name of the instance of class Lox in question.
If this variable is defined, class Lox will automatically invoke method Lox::State at the moment a first Logger is removed. In most cases this would be the at the end of the process. (The other cases are: If after a removal of a Logger, the same or another Logger is added, then the next removal of a Logger will again invoke the method.)
There are two types of arguments possible which can appear in arbitrary order. All argument identifiers are letter case agnostic.
1. State Information Flags:
See reference documentation of Lox::State for more information. The identifiers expected in this variables' arguments are: ww
None | Selects nothing. This identifier overrules all others. If found, nothing is done. |
All | Selects everything |
Basic | Name of the Lox and number of log calls |
Version | Library version and thread-safeness |
Loggers | Loggers |
Domains | Log domains currently registered |
Internaldomains | Internal domains |
Scopedomains | Scope domains |
DSR | Domain substitution rules |
PrefixLogables | Prefix logables |
Once | Log once counters |
Logdata | Log data objects |
Threadmappings | Named threads |
SPTR | Source path trim rules (C++ and C# only) |
Compilationflags | ALib compilation flags (C++ only) |
2. Attributes:
Two attributes that are affecting the invocation of Lox::State can be provided as arguments:
domain = DOMAIN_PATH | Sets a domain path for the Log.State invocation (defaults to "" ). |
verbosity = VERBOSITY | Sets a verbosity for the Log.State invocation (defaults to "Info" ). |
As a sample, take the following external variable:
ALOX/LOG_DUMP_STATE_ON_EXIT= domain=/DEBUG, verbosity = info, logdata, scopedomains
When the process terminates (precisely the first Logger is removed from the standard debug Lox instance), then method Lox::State is invoked, with
Verbosity.Info
for parameter verbosity and( LogData & ScopeDomains )