ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
lox.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-2025 A-Worx GmbH, Germany.
6/// Published under \ref mainpage_license "Boost Software License".
7
8
9ALIB_EXPORT namespace alib { namespace lox {
10
11//==================================================================================================
12/// This class acts as a container for \e Loggers and provides a convenient interface to logging.
13//==================================================================================================
14class Lox
15{
16 #if !DOXYGEN
17 friend class ALox;
18 friend struct detail::LI;
19 #endif
20
21 protected:
22 /// The implementation.
23 detail::LoxImpl* impl;
24
25 public:
26 /// This is the path for logging to the internal domain. By manipulating this
27 /// <em>%Log %Domain's %Verbosity</em>, the verbosity of \alox itself can be controlled.
28 /// For example, with \e Verbosity.INFO, the 'on the fly' creation of <em>Log Domains</em>
29 /// are logged, which can be helpful to determine the <em>Lo bg Domains</em> that are
30 /// created by libraries and larger projects.
31 ///
32 /// The following Subdomains are used by \alox:
33 ///
34 /// Subdomain | Description
35 /// - - - - - -| - - - - - - - - - - - - - - - - - - -
36 /// LGR | Used when \e %Loggers are registered, retrieved or removed from a \b %Lox and when the \e Verbosity of a <em>Log Domain</em> for a \e %Logger is changed.<br>In addition used with method \b %Lox::SetStartTime.
37 /// DMN | Used when <em>Log Domains</em> are registered (on first use), when <em>Scope Domains</em> are set or removed and when <em>Domain Substitution Rules</em> are set.
38 /// PFX | Used when <em>Prefix Logables</em> are set or removed.
39 /// THR | Used with method \b %Lox::MapThreadName.
40 /// LGD | Used with storing and retrieving <em>Log Data</em> objects.
41 ///
42 /// \note For internal logging an separated <em>domain tree</em> is used. This means, that
43 /// setting the root domain of a \b %Lox to a certain \e Verbosity does \e not affect
44 /// the internal domains. In other words, the \e Verbosity of the internal domain
45 /// (or one of its Subdomains) has to be set explicitly.
46 ///
47 static constexpr NString InternalDomains { "$/" };
48
49 // #############################################################################################
50 // Constructors/destructor
51 // #############################################################################################
52 //==========================================================================================
53 /// Constructs a new, empty Lox with the given \p{name}.
54 /// The name is immutable and all \b %Lox objects registered with \alox must be unique.
55 /// Lower case letters in the name are converted to upper case.
56 /// The name \c "Log" is reserved for the internal default singleton used for debug-logging.
57 /// In addition, name \c "GLOBAL" is not allowed.
58 ///
59 /// If parameter \p{register} is \c true (the default), static method
60 /// \alib{lox,ALoxCamp::Register} is invoked and the object will be
61 /// retrievable with static method
62 /// \alib{lox,ALoxCamp::Get}. In some situations, such 'registration'
63 /// may not be wanted.
64 ///
65 /// @param name The name of the Lox. Will be copied and converted to upper case.
66 /// @param doRegister If \c true, this object is registered with static class
67 /// \alib{lox,ALoxCamp}.
68 /// Optional and defaults to \c true.
69 //==========================================================================================
71 Lox(const NString& name, bool doRegister =true );
72
73 //==========================================================================================
74 /// Destructs a lox
75 //==========================================================================================
77 ~Lox();
78
79
80 /// Returns a \b %Lox with the given name.
81 /// A \b %Lox is only found if it was created and registered with \alox using #Register.
82 /// If not found, and parameter \p{create} is \c true (the default), a new \b Lox is created,
83 /// registered and returned.
84 ///
85 /// @param name The name of the \b %Lox to search and optionally to create.
86 /// Comparison is case-insensitive.
87 /// @param create Denotes whether a \b %Lox that was not found is created.
88 /// Optional and defaults to \b %CreateIfNotExists::No.
89 /// @return The \b Lox found, \c nullptr in case of failure.
91 static Lox* Get( const NString& name,
93
94 /// Registers or un-registers a \b %Lox object statically with \alox.
95 /// Once registered, any code entity of the same process is enabled to retrieve
96 /// the \b %Lox using #Get.<br>
97 /// No two objects with the same name must be registered. If this is done, the latter
98 /// will not be registered and not be found by #Get. In debug-compilations, an \alib
99 /// assertion is raised if a name is registered twice.<br>
100 /// Note that name comparison is performed case <b>in</b>-sensitive.
101 ///
102 /// If debug-logging is enabled (depends on optional compiler-symbols) and used, the
103 /// singleton of type \c %Lox provided for debug-logging is registered. This uses the name
104 /// \c "Log".
105 ///
106 /// Registration is \e not mandatory but done by default by the constructor of class \b %Lox.
107 /// Therefore, to keep a \b Lox private, an optional parameter is available.
108 ///
109 /// @param lox The \b %Lox to register.
110 /// @param operation If \b %ContainerOp::Remove, the given \p{Lox} is deregistered.
111 /// Defaults to \b %ContainerOp::Insert.
113 static void Register( Lox* lox, lang::ContainerOp operation );
114
115
116 // #############################################################################################
117 // Interface
118 // #############################################################################################
119 //==========================================================================================
120 /// Returns the name of this \b %Lox. The name is user-defined, and provided in the
121 /// constructor,
122 /// converted to upper case and otherwise immutable.
123 ///
124 /// @returns The name of this %Lox.
125 //==========================================================================================
127 {
128 return detail::LI::GetName( impl );
129 }
130
131 //==========================================================================================
132 /// Returns the number of logs that have been performed with this \b Lox.
133 /// The counter is not used internally other than for providing a
134 /// unique log number: While each logger attached has a own number, if more than one
135 /// logger is attached, their numbers may differ due to different log domain settings.
136 /// \note
137 /// The result is given as a mutual reference to the internal counter, which is allowed
138 /// to be manipulated. This is for example used in unit tests.
139 ///
140 /// @returns \c true if this instance was registered with \alox, \c false if not.
141 //==========================================================================================
146
147 /// Acquires this \b %Lox and sets the scope information data for the next log.
148 /// @param ci The source location that the call is placed at.
150
151 //==========================================================================================
152 /// Releases ownership of this object. If #Acquire was called multiple times, the same
153 /// number of calls to this method have to be performed to release ownership.
154 //==========================================================================================
156
157 //==========================================================================================
158 /// Resets this object.
159 ///
160 /// \attention
161 /// This method was introduced to support resetting the debug \b %Lox objects in the unit
162 /// tests. In real applications, and for release logging it recommended to delete a Lox
163 /// and create a new one instead of resetting one.
164 /// Side effects might appear when using this method!
165 //==========================================================================================
166 void Reset()
167 {
169 }
170
171 /// Changes the capacity of the \b %LRUCacheTable for parsed file names by calling
172 /// \alib{containers;LRUCacheTable::Reserve}.
173 /// @param numberOfLists The number of LRU-lists to use.
174 /// @param entriesPerList The maximum length of each cache list.
175 void SetFileNameCacheCapacity(integer numberOfLists, integer entriesPerList )
176 {
177 detail::LI::SetFileNameCacheCapacity(impl, numberOfLists, entriesPerList );
178 }
179
180 //==========================================================================================
181 /// Adds \p{path} to an internal list of substrings that are used to trim the path of
182 /// a source file name. Trimmed paths are used for \e Scope mechanisms and can be
183 /// logged (e.g., with meta-information of class \b TextLogger.
184 ///
185 /// By default such setting affects all instances of class \b Lox, not only
186 /// this instance. This can be altered using parameter \p{global}.
187 /// one other The given trim information can either
188 ///
189 /// If given \p{path} starts with character <c> '*'</c>, the rest of the string is searched
190 /// within source paths. Otherwise, it is checked if a source path starts with the given
191 /// path.
192 ///
193 /// Parameter \p{trimReplacement} optionally provides a replacement string for the trimmed
194 /// path. This can be used for example to provide the right absolute path for an IDE
195 /// to find source files of a library.
196 ///
197 /// Parameter \p{includeString} determines if the searched substring should be included in the
198 /// resulting source path or not. In addition, parameter \p{trimOffset}, which can be negative
199 /// or positive, is added to the position of trimming. This can be used to increase the
200 /// length of the search path, and then cut only a portion of what was searched for.
201 ///
202 /// Finally, parameter \p{sensitivity} determines whether the match is performed case
203 /// sensitive or not. It defaults to non-sensitive, for convenience and for the fact that
204 /// for example Microsoft C++ compiler's preprocessor passes lower case path-strings!
205 ///
206 /// \note
207 /// If the platform (compiler) specific path separator is <c>'/'</c>, then characters
208 /// <c>'\'</c> found in parameters \p{path} and \p{trimReplacement} are replaced by <c>'\'</c>
209 /// and vice versa. This allows specifying paths and substrings thereof in a platform
210 /// independent way.
211 ///
212 /// \attention
213 /// Setting global rules (when parameter \p{global} equals \c Inclusion::Include) is not
214 /// protected by a \c mutex against concurrent access. Therefore, global rules have
215 /// to be either at bootstrap of a process, before threads are created, or such creation
216 /// has to 'manually' be protected by locking all existing instances of this class!
217 ///
218 /// @param path The path to search for. If not starting with <c> '*'</c>,
219 /// a prefix is searched.
220 /// @param includeString Determines if \p{path} should be included in the trimmed path or
221 /// not.
222 /// Optional and defaults to \b %Inclusion::Exclude.
223 /// @param trimOffset Adjusts the portion of \p{path} that is trimmed.
224 /// Optional and defaults to \c 0.
225 /// @param sensitivity Determines if the comparison of \p{path} with a source file's path
226 /// is performed case-sensitive or not.
227 /// Optional and defaults to \b Case::Ignore.
228 /// @param trimReplacement Replacement string for trimmed portion of the path.
229 /// Optional and defaults to \b %NULL_STRING.
230 /// @param reach Denotes whether the rule is applied locally (to this \b %Lox only)
231 /// or applies to all instances of class \b %Lox.
232 /// Defaults to \b %Reach::Global.
233 /// @param priority The priority of the setting. Defaults to
234 /// \alib{variables;Priority;Standard}.
235 //==========================================================================================
238 int trimOffset = 0,
239 lang::Case sensitivity = lang::Case::Ignore,
240 const NString& trimReplacement = NULL_NSTRING,
242 Priority priority = Priority::Standard )
243
244 {
245 detail::LI::SetSourcePathTrimRule( impl, path, includeString, trimOffset, sensitivity,
246 trimReplacement, reach, priority );
247 }
248
249
250 //==========================================================================================
251 /// Removes all local trimming rules set with #SetSourcePathTrimRule.
252 /// If parameter \p{global} is set to \b Inclusion::Include, the global rules are cleared
253 /// in addition.
254 ///
255 /// Setting parameter \p{allowAutoRule} to \c false, allows suppressing the creation of an
256 /// automatic rule based on the executables path.
257 ///
258 /// \see Chapter \ref alib_mod_alox_trim_source_path for more information.
259 ///
260 /// @param reach Denotes whether only local rules are cleared or also global ones.
261 /// Defaults to \b %Reach::Global.
262 /// @param allowAutoRule Determines if an auto rule should be tried to be detected next
263 /// no appropriate rule is found.
264 //==========================================================================================
266 bool allowAutoRule = true )
267 {
270 999999, // code for clearing
271 lang::Case::Ignore, NULL_NSTRING, reach, Priority::NONE );
272 }
273
274 //==========================================================================================
275 /// This static method creates a console logger. To decide which logger type to choose,
276 /// configuration variable \ref alxcvALOX_CONSOLE_TYPE is checked. If this variable is not set,
277 /// then the decision is made as follows:
278 /// - On GNU/Linux OS, a
279 /// \ref alib::lox::loggers::AnsiConsoleLogger "AnsiConsoleLogger" is chosen.
280 /// - On Windows OS, if a console window is attached, type
281 /// \ref alib::lox::loggers::WindowsConsoleLogger "WindowsConsoleLogger" is chosen. If
282 /// no console is attached to the process, instead a
283 /// \ref alib::lox::loggers::ConsoleLogger "ConsoleLogger" is returned.
284 ///
285 ///
286 /// @param name The name of the \e Logger. Defaults to nullptr, which uses standard
287 /// names defined by derived \e Logger types.
288 ///
289 /// @return An instance of the chosen console type logger.
290 //==========================================================================================
291 ALIB_DLL static
292 textlogger::TextLogger* CreateConsoleLogger( const NString& name= nullptr );
293
294 //==========================================================================================
295 /// Retrieves an instance of a Logger by its name. This might be useful when access to a
296 /// \e %Logger is needed to change its configuration.
297 ///
298 /// @param loggerName The name of the \e Logger to search for (case-insensitive).
299 /// @return The logger, nullptr if not found.
300 //==========================================================================================
301 detail::Logger* GetLogger( const NString& loggerName )
302 {
303 return detail::LI::GetLogger(impl, loggerName);
304 }
305
306 //==========================================================================================
307 /// Removes a logger from this container.
308 /// \note
309 /// To (temporarily) disable a logger without removing it, a call to
310 /// \ref SetVerbosity(detail::Logger*,Verbosity,const NString&,Priority) "SetVerbosity(logger, Verbosity::Off)"
311 /// can be used.
312 ///
313 /// @param logger The logger to be removed.
314 /// @returns \c true, if the \e Logger was found and removed, \c false otherwise.
315 //==========================================================================================
317 {
318 return detail::LI::RemoveLogger(impl, logger);
319 }
320
321 //==========================================================================================
322 /// Removes logger named \p{loggerName} from this container.
323 /// \note
324 /// To (temporarily) disable a logger without removing it, a call to
325 /// \ref SetVerbosity(detail::Logger*,Verbosity,const NString&,Priority) "SetVerbosity(logger, Verbosity::Off)"
326 /// can be used.
327 ///
328 /// @param loggerName The name of the \e Logger(s) to be removed (case-insensitive).
329 /// @returns The logger that was removed, \c nullptr if not found.
330 //==========================================================================================
331 detail::Logger* RemoveLogger( const NString& loggerName )
332 {
333 return detail::LI::RemoveLogger(impl, loggerName);
334 }
335
336 //==========================================================================================
337 /// Sets the \e %Verbosity of the <em>Log Domain</em> which is evaluated from parameter
338 /// \p{domain} and applicable <em>Scope Domains</em>. The \p{verbosity} given is set
339 /// recursively for all Subdomains.
340 ///
341 /// With the first invocation of this method for a distinct \p{logger}, this \e %Logger
342 /// is registered with this \e %Lox. In this case, before setting the given \e Verbosity
343 /// for the evaluated subdomain, the \e Verbosity for all domains is set to
344 /// \b %Verbosity::Off.
345 ///
346 /// To deregister a \e Logger with a \b Lox, use method #RemoveLogger.
347 /// To 'disable' a \e Logger, invoke this method with parameters \p{verbosity} equaling to
348 /// \b %Verbosity::Off and \p{domain} to \c "/".
349 ///
350 /// Optional parameter \p{priority} defaults to
351 /// \alib{variables;Priority;Standard},
352 /// which is a lower priority than those of the standard plug-ins of external configuration
353 /// data. Therefore, external configuration by default 'overwrite' settings made from
354 /// 'within the source code', which simply means by invoking this method.<br>
355 /// The parameter can be provided for two main reasons:
356 /// - To 'lock' a verbosity setting against external manipulation.
357 /// - to 'break' the standard mechanism that an invocation of this method sets all
358 /// Subdomains recursively. If a subdomain was set with a higher priority
359 /// (e.g., <c>%Config::PriorityOf(Priority::Standard) + 1</c>, then this subdomain will
360 /// not be affected by future invocations of this method with standard-priority given.
361 ///
362 /// For more information on how to use external configuration variables with priority and
363 /// on protecting verbosity settings, consult the \ref alib_mod_alox.
364 ///
365 /// \attention
366 /// The same as with most interface methods of this class, the given \p{domain} parameter is
367 /// combined with <em>%Scope Domains</em> set for the caller's \e %Scope. In standard use
368 /// cases of %ALox, the \e %Verbosity of a \e Domain is set using absolute domain path
369 /// addressing. Therefore, it is recommended to have any domain path passed to this method
370 /// starting with <c> '/'</c>, which suppresses the concatenation of <em>%Scope Domains</em>.<br>
371 /// This is why this parameter with this method defaults to <c> '/'</c>, while with other
372 /// methods of this class, it defaults to an empty string.
373 /// <p>
374 /// \attention
375 /// Even when using an absolute domain path, <em>%Scope Domains</em> of
376 /// \e %Scope::ThreadInner, will still apply. This means that from within a thread that
377 /// has such <em>%Scope Domain</em> set, this method is (almost) not usable!
378 /// This all aligns with the concept (advice), that \e Loggers and their \e %Verbosity
379 /// are generally set outside of such scopes, hence in configuration sections of a
380 /// process.<p>
381 /// \attention
382 /// Consequently, this method may be (mis-) used to modify the 'actual' (default) scope
383 /// when explicitly giving an empty string with parameter \p{domain}. This is useful, to
384 /// temporarily adjust a scope. But remember: \alox was designed to avoid temporary
385 /// code lines...
386 ///
387 /// @param logger The logger to be to be affected (case-insensitive).
388 /// @param verbosity The 'level of verboseness' to be set.
389 /// @param domain The parent (start) domain to be set. The use of absolute paths
390 /// starting with <c> '/'</c> are recommended.
391 /// Defaults to root domain \"/\".
392 /// @param priority The priority of the setting. Defaults to
393 /// \alib{variables;Priority;Standard}.
394 //==========================================================================================
396 Verbosity verbosity,
397 const NString& domain = "/",
398 Priority priority = Priority::Standard )
399 {
400 detail::LI::SetVerbosity(impl, logger, verbosity, domain, priority);
401 }
402
403 //==========================================================================================
404 /// Same as
405 /// \ref #SetVerbosity(detail::Logger*,Verbosity,const NString&,Priority) "SetVerbosity"
406 /// but addressing the \e %Logger to manipulate by its name.<br>
407 /// This method may only be used after a \e %Logger was once 'registered' with this \b %Lox
408 /// using
409 /// \ref #SetVerbosity(detail::Logger*,Verbosity,const NString&,Priority) "SetVerbosity".
410 ///
411 /// @param loggerName The logger to be to be affected, identified by its name (case
412 /// insensitive).
413 /// @param verbosity The 'level of verboseness' to be set.
414 /// @param domain The parent (start) domain to be set. The use of absolute paths
415 /// starting with <c> '/'</c> are recommended.
416 /// Defaults to root domain \"/\".
417 /// @param priority The priority of the setting. Defaults to
418 /// \alib{variables;Priority;Standard}.
419 //==========================================================================================
420 void SetVerbosity( const NString& loggerName,
421 Verbosity verbosity,
422 const NString& domain = "/",
423 Priority priority = Priority::Standard )
424 {
425 detail::LI::SetVerbosity(impl, loggerName, verbosity, domain, priority);
426 }
427
428 //==========================================================================================
429 /// The given \p{scopeDomain} becomes the default domain path for given \p{scope}.
430 /// This means, that any subsequent log invocations (from within this same scope) can omit
431 /// the domain parameter, or if they provide one, this Scope Domain path is prepended.
432 /// If subsequent log calls specify a domain name with a leading '/' character,
433 /// then the Scope Domain of the scope is ignored.<br>
434 /// Furthermore, if the given scope is an inner scope, outer scopes are prepended to the
435 /// given \p{scopeDomain} when the resulting domain of a log invocation is evaluated.
436 /// Again, this behavior can be overruled by prepending a leading '/' character to
437 /// \p{scopeDomain}.
438 ///
439 /// To remove a previously set Scope Domain a \e nulled or empty string has to be passed with
440 /// parameter \p{scopeDomain}.
441 /// For \e %Scope::ThreadOuter and \e %Scope::ThreadInner, passing an empty or \e nulled
442 /// string removes the most recently added domain path. For removing an explicitly named
443 /// domain path of \e %Scope::ThreadOuter and \e %Scope::ThreadInner use method
444 /// #RemoveThreadDomain.
445 ///
446 /// \note
447 /// The C++ version of \alox implements scope mechanisms using scope information generated
448 /// by the preprocessor. By default, debug logging supports such caller information,
449 /// release logging does not. This can be changed.<br>
450 /// For more information on how to change such defaults, see documentation of preprocessor
451 /// symbols \ref ALOX_DBG_LOG_CI and \ref ALOX_REL_LOG_CI.
452 ///
453 /// @param scopeDomain The domain path to register.
454 /// @param scope The scope that should the given \p{domain} be registered for.
455 /// Available Scope definitions are platform/language dependent.
456 //==========================================================================================
457 void SetDomain( const NString& scopeDomain, Scope scope )
458 {
459 detail::LI::setDomain(impl, scopeDomain, scope, false, nullptr );
460 }
461
462 //==========================================================================================
463 /// This overloaded version of
464 /// \ref SetDomain(const NString&,Scope) "SetDomain" is applicable only for
465 /// \e %Scope::ThreadOuter and \e %Scope::ThreadInner and allows specifying the thread that
466 /// the setting should be associated with.
467 ///
468 /// If \p{scopeDomain} is nullptr or empty, the most recently added domain path is removed.
469 /// For removing an explicitly named domain associated with a thread use method
470 /// #RemoveThreadDomain.
471 ///
472 /// @param scopeDomain The domain path to register.
473 /// @param scope Either \e %Scope::ThreadOuter or \e %Scope::ThreadInner. With other
474 /// values, an internal error is logged.
475 /// @param thread The thread to set/unset a thread-related Scope Domains for.
476 //==========================================================================================
477 void SetDomain( const NString& scopeDomain, Scope scope, threads::Thread* thread )
478 {
479 detail::LI::setDomain( impl, scopeDomain, scope, false, thread );
480 }
481
482 //==========================================================================================
483 /// Adds a <em>Domain Substitution Rule</em>.
484 /// <em>Domain Substitution</em> is performed as a last step when evaluating the domain path
485 /// of a <em>Log Statement</em>, taking <em>Scope Domains</em> and the optional parameter
486 /// \p{domain} of the statement into account.<br>
487 ///
488 /// <b>Wildcards</b><br>
489 /// Parameter \p{domainPath} supports \b 'wildcard' character <c> '*'</c> at its beginning
490 /// and at its end (or both). This allows having four types of rules:
491 /// - Exact match
492 /// - Prefix match (\c * at the end of \p{domainPath})
493 /// - Suffix match (\c * at the start of \p{domainPath})
494 /// - Substring match (\c * at both, start and the end of \p{domainPath})
495 ///
496 /// Only minimal checks are performed, e.g., if an exact match is requested, but \p{domainPath}
497 /// does not start with character <c> '/'</c>. In this and some other cases, the rule is not
498 /// stored and an internal warning is logged. Further checks, for example, for illegal
499 /// domain path characters, are not performed.
500 /// (Illegal domain path characters will be eliminated when the resulting domain path is to
501 /// be created internally).
502 ///
503 /// <b>Circular Dependencies</b><br>
504 /// If the given rules have circular dependencies, only a limited number (ten) replacements
505 /// are performed. If this number of replacements for one <em>Log Statement</em> is exceeded,
506 /// an internal warning message is logged. This is done only \e once over the life-time of
507 /// a \e Logger.
508 ///
509 /// <b>Application of Rules</b><br>
510 /// Rules are applied in the order of their definition. After all rules have been applied,
511 /// this is repeated as long as at least one rule matches (up to ten times).
512 ///
513 /// <b>Deletion of Rules</b>
514 /// To delete a rule, invoke the method with the same parameter \p{domainPath} but with
515 /// a \e 'nulled' or empty string for parameter \p{replacement}.
516 /// To delete all rules, invoke the method with parameter \p{domainPath} \e 'nulled'
517 /// or empty.
518 ///
519 /// <b>Final remarks</b>
520 /// Domain substitution is useful to permanently change ('redirect') domain paths of
521 /// 3rd party code (e.g., libraries using \alox) or log statements that must not be changed
522 /// for other reasons. It is advised to not 'overuse' this feature, as side effects
523 /// are inherent to the concept of <em>Domain Substitution</em>. For example, an unwanted
524 /// side effect might be that <em>Prefix Logables</em> are not applicable to the substituted
525 /// domain, while other <em>Prefix Logables</em> are bound to the resulting domain.
526 ///
527 /// For \b %Lox objects that should be protected of external manipulation, it is advisable
528 /// to remove all <em>Domain Substitution Rules</em> right after the \b %Lox was created by
529 /// invoking this method with a \e nulled value for parameter \p{domainPath}.
530 /// The reason is that otherwise, through configuration files or command line parameters,
531 /// domains of the \b %Lox can be substituted and then the resulting domains \e Verbosities
532 /// be \e overwritten using further configuration variables.
533 /// Any prioritized \e 'internal' setting of \e Verbosities this way could be circumvented!
534 ///
535 /// For more information, consult the chapter \ref alib_mod_alox_domain_substitution of the
536 /// Programmer's Manual.
537 ///
538 /// @param domainPath The path to search. Has to start with either <c>'/'</c> or <c>'*'</c>.
539 /// @param replacement The replacement path.
540 //==========================================================================================
541 void SetDomainSubstitutionRule( const NString& domainPath, const NString& replacement )
542 {
543 detail::LI::SetDomainSubstitutionRule(impl, domainPath, replacement);
544 }
545
546 //==========================================================================================
547 /// This method is used to remove an <em>explicitly given</em> domain path from the list
548 /// of domain paths set for \e %Scope::ThreadOuter or \e %Scope::ThreadInner.
549 ///
550 /// To remove the most recently added domain path from such thread-related \e %Scope,
551 /// use one of the overloaded methods #SetDomain and provide an empty or \e nulled
552 /// value for parameter \p{scopeDomain} (the same as how domain paths of other \e %Scopes
553 /// are removed).
554 ///
555 /// \note
556 /// The long name of the method already indicates that this method is a little special.
557 /// Only seldom, more than one <em>%Scope Domain</em> is needed to be added. And if this
558 /// is needed, then such <em>%Scope Domains</em> usually get removed in reverse order of
559 /// their definition, with is performed using the standard interface that allows 'removing'
560 /// any other <em>%Scope Domain</em>. (Passing an empty or \e nulled domain
561 /// path to method #SetDomain.)
562 ///
563 /// @param scopeDomain The domain path to register.
564 /// @param scope Either \e %Scope::ThreadOuter or \e %Scope::ThreadInner. With other
565 /// values, an internal error is logged.
566 /// @param thread The thread to set/unset a thread-related Scope Domains for.
567 /// Defaults to the current thread.
568 //==========================================================================================
569 void RemoveThreadDomain( const NString& scopeDomain, Scope scope,
570 threads::Thread* thread= nullptr )
571 {
572 detail::LI::RemoveThreadDomain(impl, scopeDomain, scope, thread);
573 }
574
575 //==========================================================================================
576 /// The given \p{prefix} becomes a <em>Prefix Logable</em> provided to loggers with each log
577 /// statement executed within the given \p{scope}.
578 /// The list of objects received by a logger is sorted from outer scope to inner scope.
579 /// The logable of the <em>%Log Statement</em> itself, is the last in the list, except one or
580 /// more <em>Prefix Logables</em> of \e %Scope::ThreadInner are set. Those are (similar to how
581 /// this \e %Scope is used with <em>%Scope Domains</em>) appended to the end of the
582 /// list.
583 ///
584 /// To remove a previously set <em>Prefix Logable</em>, \c nullptr has to be passed with
585 /// parameter \p{prefix}.
586 /// For \e %Scope::ThreadOuter and \e %Scope::ThreadInner, passing \c nullptr (respectively
587 /// with the overloaded method accepting string messages, a \e nulled string)
588 /// removes the most recently added <em>Prefix Logable</em>.
589 ///
590 ///
591 /// \note
592 /// \e Logables of boxed character array types are duplicated internally by \alox when
593 /// setting as <em>Prefix Logables</em>.
594 /// This means, in contrast to other types, for string-type <em>Prefix Logables</em>
595 /// the life-cycle of the object passed in parameter \p{prefix} is allowed to end
596 /// right after the invocation of this method. This is a convenience feature of \alox.
597 /// However, this also means, that changes of the strings that occur after the string
598 /// objects got set as a <em>Prefix Logable</em>, are \b not reflected.<br>
599 /// To implement a "variable" <em>Prefix Logable</em> of string-type, an object of type
600 /// \b %AString might be passed wrapped in class \c std::reference_wrapper<AString>.<br>
601 /// For more information, consult manual chapter
602 /// \ref alib_mod_alox_prefix_logables_lifecycle
603 /// as well as chapter \ref alib_boxing_customizing_identity of the Programmer's Manual
604 /// of module \alib_boxing.
605 ///<p>
606 /// \note
607 /// Unlike other methods of this class which accept an arbitrary amount of logables, this
608 /// method and its overloaded variants accept only one logable (the prefix).
609 /// To supply several objects to be prefix logables at once, a container of type
610 /// \alib{boxing;TBoxes} may be passed with parameter \p{logables}, like
611 /// in the following sample:
612 /// \snippet "ut_alox_log_scopes.cpp" DOX_ALOX_LOX_SETPREFIX
613 /// The provided container as well as the prefixes themselves have to be kept in memory
614 /// until they are unset.
615 ///
616 ///<p>
617 /// \note
618 /// The C++ version of \alox implements scope mechanisms using scope information
619 /// generated by the preprocessor. By default, debug logging supports such caller
620 /// information, release logging does not. Both defaults can be changed with preprocessor
621 /// symbols \ref ALOX_DBG_LOG_CI and \ref ALOX_REL_LOG_CI.
622 ///
623 ///<p>
624 /// \note
625 /// The word 'prefix' in this method's name and in the name of \alox feature
626 /// <em>Prefix Logables</em> is chosen for the fact that with text loggers (which is the
627 /// most widely applied use case for \alox) such objects are prefixes to the log
628 /// message. Of course, with using \e %Scope::ThreadInner, this turns into a suffix!<br>
629 /// When using \alox to process arbitrary objects instead of text messages, the concept of
630 /// <em>Prefix Logables</em> is still very useful. Just the name does not fit so well anymore.
631 /// Think of 'SetContext' and <em>Context Objects</em> instead.
632 ///
633 /// @param prefix The <em>Prefix Logable</em> to set.
634 /// @param scope The scope that should the given \p{domain} be registered for.
635 /// Available Scope definitions are platform/language dependent.
636 //==========================================================================================
637 void SetPrefix( const Box& prefix, Scope scope )
638 {
639 detail::LI::setPrefix( impl, prefix, scope, nullptr );
640 }
641
642 //==========================================================================================
643 /// This overloaded version of
644 /// \ref SetPrefix(const Box&,Scope) "SetPrefix" is applicable only for
645 /// \b %Scope::ThreadOuter and \b %Scope::ThreadInner and allows specifying the thread that
646 /// the setting should be associated with.
647 ///
648 /// If \p{scopeDomain} is nullptr or empty, the most recently added <em>Prefix Logable</em>
649 /// is removed.
650 ///
651 /// @param prefix The <em>Prefix Logable</em> to set.
652 /// @param scope Either \e %Scope::ThreadOuter or \e %Scope::ThreadInner. With other
653 /// values, an internal error is logged.
654 /// @param thread The thread to set/unset a thread-related Scope Domains for.
655 //==========================================================================================
656 void SetPrefix( const Box& prefix, Scope scope, threads::Thread* thread )
657 {
658 detail::LI::setPrefix( impl, prefix, scope, thread );
659 }
660
661 //==========================================================================================
662 /// The given \p{prefix} becomes a <em>Prefix Logable</em> associated to the given
663 /// <em>Log Domain</em>.
664 /// <em>Prefix Logables</em> associated with the <em>Log Domain</em> are added to the
665 /// list of \e Logables right
666 /// before the main \e Logable of the <em>Log Statement</em> itself.
667 /// Multiple <em>Prefix Logables</em> can be added per <em>Log Domain</em>.
668 ///
669 /// To remove the most recently added <em>Prefix Logable</em> associated with a <em>Log Domain</em>,
670 /// \c nullptr has to be passed with parameter \p{prefix}.
671 ///
672 /// \note
673 /// String-type \e Logables are duplicated internally by \alox when setting as
674 /// <em>Prefix Logables</em>.
675 /// This means, different to <em>Prefix Logables</em> of type \b %AString or custom types,
676 /// the life-cycle of the object passed in parameter \p{prefix} is allowed to end
677 /// right after the invocation of this method. For more information, consult manual chapter
678 /// \ref alib_mod_alox_prefix_logables_lifecycle as well as chapter
679 /// \ref alib_boxing_customizing_identity of the Programmer's Manual of module
680 /// \alib_boxing.
681 ///
682 /// \attention
683 /// The same as with most interface methods of this class, the given \p{domain} parameter
684 /// is combined with <em>%Scope Domains</em> set for the caller's \e %Scope.
685 /// To suppress this, an absolute domain path can be used. (Still any <em>Scope Domain</em>
686 /// of \e %Scope::Thread::Inner will be applied).
687 /// The default value of parameter \p{domain} is \c "" which addresses the domain evaluated
688 /// for the current scope.
689 ///
690 /// @param prefix The <em>Prefix Logable</em> to set.
691 /// @param domain The domain path. Defaults to \c nullptr, resulting in
692 /// evaluated <em>Scope Domain</em> path.
693 /// @param otherPLs If set to \c Inclusion::Exclude, scope-related
694 /// <em>Prefix Logables</em> are ignored and only domain-related
695 /// <em>Prefix Logables</em> are passed to the \e Loggers.<br>
696 /// Defaults to \c Inclusion::Include.
697 //==========================================================================================
698 void SetPrefix( const Box& prefix, const NString& domain= nullptr,
700 {
701 detail::LI::SetPrefix(impl, prefix, domain, otherPLs);
702 }
703
704 //==========================================================================================
705 /// This method is used reset (or to explicitly set) the start time of one or all logger(s).
706 /// The only impact is the output of time differences in the log lines. Hence, this method
707 /// is useful to reset them and see some absolute time values when doing basic performance
708 /// tests using the \e Logger.
709 ///
710 /// \note This affects loggers that are registered for at least one standard domain.
711 /// In other words, loggers that are exclusively attached to the internal domain,
712 /// will not be affected.
713 ///
714 /// @param startTime Optional parameter with the new start time. Defaults
715 /// to current time if omitted.
716 /// @param loggerName The name of the \e Logger(s) whose start time is to be set
717 /// (case-insensitive).
718 /// Defaults to nullptr, which indicates that all loggers are to
719 /// be affected.
720 //==========================================================================================
721 void SetStartTime( Ticks startTime = time::Ticks (),
722 const NString& loggerName = nullptr )
723 {
724 detail::LI::SetStartTime(impl, startTime, loggerName);
725 }
726
727 #if defined (__GLIBCXX__) || defined(_LIBCPP_VERSION) || defined(__APPLE__)
728 //======================================================================================
729 /// Converts the given \p{startTime} and invokes #SetStartTime(Ticks,const NString&).
730 /// \note GLib specific.
731 ///
732 /// @param startTime The new start time in system-specific time unit.
733 /// @param loggerName The name of the \e Logger whose start time is to be set (case
734 /// insensitive).
735 /// Defaults to empty string, which indicates that all loggers are to
736 /// be affected.
737 //======================================================================================
738 void SetStartTime( time_t startTime, const NString& loggerName= nullptr )
739 {
740 detail::LI::SetStartTime(impl, startTime, loggerName);
741 }
742
743
744 #endif // no elif here, otherwise doxygen would ignore it!
745
746 #if defined( _MSC_VER )
747 //======================================================================================
748 /// Converts the given \p{startTime} and invokes#SetStartTime(Ticks,const NString&).
749 /// \note Microsoft Windows specific.
750 ///
751 /// @param startTime The new start time in system-specific time unit.
752 /// @param loggerName The name of the \e Logger whose start time is to be set (case
753 /// insensitive).
754 /// Defaults to empty string, which indicates that all loggers are to
755 /// be affected.
756 //======================================================================================
757 void SetStartTime( const FILETIME& startTime, const NString& loggerName= nullptr )
758 {
759 detail::LI::SetStartTime(impl, startTime, loggerName);
760 }
761
762 #endif
763
764 //==========================================================================================
765 /// This method sets a human-readable name to the given thread ID (or current thread) which
766 /// is optionally included in each log line.
767 ///
768 /// @param threadName The name of the thread as it should be displayed in the logs.
769 /// @param id (Optional) Parameter providing the thread ID. If omitted, the
770 /// current thread's ID is used.<br>
771 /// If given, the associated object of \alib{threads;Thread} must not
772 /// be deleted until this method returns. This is a race condition
773 /// that a using code has do ensure.
774 //==========================================================================================
775 void MapThreadName( const String& threadName, threads::ThreadID id= 0 )
776 {
777 detail::LI::MapThreadName(impl, threadName, id);
778 }
779
780 //==========================================================================================
781 /// Stores data encapsulated in an object of class
782 /// \ref alib::boxing::Box "Box" which can be retrieved back by invoking
783 /// #Retrieve. Using the optional \p{key} and \p{scope} offer various possibilities to
784 /// reference this data later.
785 ///
786 /// To remove data from the store, pass \c nullptr with parameter \p{data}.
787 ///
788 /// \attention
789 /// When data objects are 'overwritten', previous objects will be deleted internally.
790 /// Hence, only pointers to heap-allocated objects (created with \c new) may be passed!<br>
791 /// For more information, consult chapter \ref alib_mod_alox_log_data of the
792 /// Programmer's Manual.
793 ///
794 /// \note <em>Log Data</em> is a feature provided by \alox to support debug-logging.
795 /// It is not advised to use <em>Log Data</em> to implement application logic.
796 ///
797 /// @param data The data object to store.
798 /// If \c nullptr, currently stored data will be removed.
799 /// In C++, has to be heap allocated and will be deleted
800 /// by this \b %Lox when overwritten or this lox is deleted.
801 /// @param key The optional key to the data.
802 /// If omitted (or empty or nullptr), the data is bound to the \e %Scope
803 /// provided. If omitted and \p{scope} is Scope::Global, then the
804 /// data is unique to the \e Lox.
805 /// @param scope The \e %Scope that the data is bound to.
806 //==========================================================================================
807 void Store( const Box& data, const NString& key, Scope scope= Scope::Global )
808 {
809 detail::LI::store( impl, data, key, scope );
810 }
811
812 //==========================================================================================
813 /// Overloaded version of
814 /// Store(const Box&,const String&,Scope,int) "Store" which omits parameter \p{key}.
815 /// @param data The data object to store.
816 /// In C++, has to be heap allocated and will be deleted
817 /// by this \b %Lox when overwritten or this lox is deleted.
818 /// @param scope The \e %Scope that the data is bound to.
819 //==========================================================================================
820 void Store( const Box& data, Scope scope= Scope::Global )
821 {
822 detail::LI::store( impl, data, nullptr, scope );
823 }
824
825 //==========================================================================================
826 /// Retrieves \alox <em>Log Data</em>, an object type
827 /// \ref alib::boxing::Box "Box" which had been stored in a prior call to
828 /// #Store. Using the optional \p{key} and \p{scope} offer various possibilities to reference
829 /// such objects.<br>
830 ///
831 /// \note If no data is found, an \e nulled object is returned. This can be tested using method
832 /// \ref alib::boxing::Box::IsNull "Box::IsNull".
833 ///
834 /// <p>
835 /// \note <em>Log Data</em> is a feature provided by \alox to support debug-logging.
836 /// It is not advised to use <em>Log Data</em> to implement application logic.
837 ///
838 /// @param key The optional key to the data.
839 /// If omitted (or empty or nullptr), the data is bound to the \e %Scope
840 /// provided. If omitted and \p{scope} is Scope::Global, then the
841 /// data is unique to the \e Lox.
842 /// @param scope The \e %Scope that the data is bound to.
843 /// @return The data, a \e nulled box if no value was found.
844 //==========================================================================================
846 Box Retrieve ( const NString& key, Scope scope= Scope::Global )
847 {
848 return detail::LI::retrieve( impl, key, scope );
849 }
850
851 //==========================================================================================
852 /// * Overloaded version of #Retrieve which omits parameter \p{key}.
853 ///
854 /// \note <em>Log Data</em> is a feature provided by \alox to support debug-logging.
855 /// It is not advised to use <em>Log Data</em> to implement application logic.
856 ///
857 /// @param scope The \e %Scope that the data is bound to.
858 /// @return The data, a \e nulled box if no value was found.
859 //==========================================================================================
861 Box Retrieve ( Scope scope= Scope::Global )
862 {
863 return detail::LI::retrieve( impl, nullptr, scope );
864 }
865
866 //==========================================================================================
867 /// This method logs the current configuration of this Lox and its encapsulated objects.
868 /// It uses method #GetState to assemble the logable string.
869 ///
870 /// \note
871 /// As an alternative to (temporarily) adding an invocation of <b>%Lox.State</b> to
872 /// your code, \alox provides configuration variable\ref alxcvALOX_LOXNAME_DUMP_STATE_ON_EXIT.
873 /// This allows enabling an automatic invocation of this method using external
874 /// configuration data like command line parameters, environment variables or
875 /// INI files.
876 ///
877 /// @param domain Optional <em>Log Domain</em> which is combined with <em>%Scope Domains</em>
878 /// set for the \e %Scope of invocation.
879 /// @param verbosity The verbosity.
880 /// @param headLine If given, a separated headline will be logged at first place.
881 /// @param flags Flag bits that define which state information is logged.
882 //==========================================================================================
883 void State ( const NString& domain,
884 Verbosity verbosity,
885 const String& headLine,
886 StateInfo flags = StateInfo::All )
887 {
888 detail::LI::State(impl, domain, verbosity, headLine, flags);
889 }
890
891 //==========================================================================================
892 /// This method collects state information about this lox in a formatted multi-line AString.
893 /// Parameter \p{flags} is a bitwise enum type (operators on elements available).
894 ///
895 /// \note
896 /// As an alternative to (temporarily) adding an invocation of <b>%Lox.State</b> to
897 /// your code, \alox provides configuration variable \ref alxcvALOX_LOXNAME_DUMP_STATE_ON_EXIT.
898 /// This allows enabling an automatic invocation of this method using external
899 /// configuration data like command line parameters, environment variables or
900 /// INI files.
901 /// @param buf The target string.
902 /// @param flags Bits that define which state information is collected.
903 //==========================================================================================
905 {
906 detail::LI::GetState(impl, buf, flags);
907 }
908
909
910 // #############################################################################################
911 // Main logging methods
912 // #############################################################################################
913 //==========================================================================================
914 /// Returns a reference to a list of boxes to be used for logging. The list is recycled
915 /// from a previous log operation and cleared. The method may be used to retrieve
916 /// a container for logables that then are collected until finally logged.<br>
917 /// Note that the \b %Lox instance has to be acquired before invoking this method and
918 /// the container returned must be used only while the object is still acquired.
919 ///
920 /// With each recursive acquirement of this object, a different container is returned.
921 /// This is implemented to allow recursive log calls.
922 ///
923 /// @return An empty list of boxes.
924 //==========================================================================================
929
930 //==========================================================================================
931 /// Logs the current list of \e Logables that previously have been received using
932 /// #GetLogableContainer with the given \p{verbosity}.
933 ///
934 /// This method is usually \b not used directly. Instead, methods
935 /// #Info, #Verbose, #Warning and #Error provide simpler interfaces which take variadic
936 /// arguments that are collected in a list of boxed objects and then passed to
937 /// this methods.<br>
938 /// Note that the other interface methods accept an "external" list of boxes as a parameter.
939 /// as well. This means also with these methods it is allowed to collect the logables in
940 /// an user-specific list first and later pass them to these methods.
941 ///
942 /// Hence, the use of this method is recommended only if the verbosity of a log statement
943 /// is evaluated only at run-time.
944 ///
945 /// @param domain The domain.
946 /// @param verbosity The verbosity.
947 //==========================================================================================
948 void Entry( const NString& domain, Verbosity verbosity )
949 {
950 detail::LI::Entry(impl, domain, verbosity);
951 }
952
953 //==========================================================================================
954 /// Logs a list of \e Logables with the given \e %Verbosity.
955 ///
956 /// If more than one \e Logable is given and the first one is of string-type and comprises a
957 /// valid domain path, then this first argument is interpreted as the domain name!
958 /// Valid domain path are strings that consists only of characters of the following set:
959 /// - upper case letters,
960 /// - numbers,
961 /// - hyphen (\c '-'),
962 /// - underscore (\c '_') and
963 /// - forward slash (\c '/').
964 ///
965 /// If a first \e Logable could be misinterpreted as being a domain name, an empty string
966 /// (the "neutral" domain) has to be added as a first argument. Alternatively, a character
967 /// which is illegal in respect to domain names could be added to the first argument,
968 /// for example a simple space at the end of an output string.
969 ///
970 /// \note
971 /// This method allows a consistent interface of overloaded methods \b %Info, \b Error,
972 /// etc, without introducing a separate version which excepts a - then mandatory - domain
973 /// parameter.
974 /// The little drawback of the auto detection is the possibility of ambiguous invocations.
975 ///
976 /// @param verbosity The verbosity.
977 /// @param logables The list of \e Logables, optionally including a domain name at the start.
978 //==========================================================================================
979 template <typename... BoxedObjects>
980 void EntryDetectDomain( Verbosity verbosity, BoxedObjects&&... logables )
981 {
982 detail::LI::GetLogableContainer(impl).Add( std::forward<BoxedObjects>(logables)... );
984 }
985
986 //==========================================================================================
987 /// Logs given logables using \alib{lox;Verbosity;Verbosity::Verbose}.
988 ///
989 /// The first object provided may be a domain name. All values are passed to
990 /// #EntryDetectDomain. See documentation of this method for information on how to avoid
991 /// ambiguities in respect to domain names.
992 ///
993 /// If one of the arguments (or a single argument given) is of type
994 /// \alib{boxing,TBoxes}, then the contents of this list is inserted into
995 /// the list of logables. This allows collecting logables before invoking the method.
996 ///
997 /// @param logables The list of \e Logables, optionally including a domain name at the start.
998 //==========================================================================================
999 template <typename... BoxedObjects>
1000 void Verbose( BoxedObjects&&... logables )
1001 {
1002 detail::LI::GetLogableContainer(impl).Add( std::forward<BoxedObjects>(logables)... );
1003 detail::LI::entryDetectDomainImpl( impl, Verbosity::Verbose );
1004 }
1005
1006 //==========================================================================================
1007 /// Logs given logables using \alib{lox;Verbosity;Verbosity::Info}.
1008 ///
1009 /// The first object provided may be a domain name. All values are passed to
1010 /// #EntryDetectDomain. See documentation of this method for information on how to avoid
1011 /// ambiguities in respect to domain names.
1012 ///
1013 /// If one of the arguments (or a single argument given) is of type
1014 /// \alib{boxing,TBoxes}, then the contents of this list is inserted into
1015 /// the list of logables. This allows collecting logables before invoking the method.
1016 ///
1017 /// @param logables The list of \e Logables, optionally including a domain name at the start.
1018 //==========================================================================================
1019 template <typename... BoxedObjects>
1020 void Info( BoxedObjects&&... logables )
1021 {
1022 detail::LI::GetLogableContainer(impl).Add( std::forward<BoxedObjects>(logables)... );
1023 detail::LI::entryDetectDomainImpl( impl, Verbosity::Info );
1024 }
1025
1026 //==========================================================================================
1027 /// Logs given logables using \alib{lox;Verbosity;Verbosity::Warning}.
1028 ///
1029 /// The first object provided may be a domain name. All values are passed to
1030 /// #EntryDetectDomain. See documentation of this method for information on how to avoid
1031 /// ambiguities in respect to domain names.
1032 ///
1033 /// If one of the arguments (or a single argument given) is of type
1034 /// \alib{boxing,TBoxes}, then the contents of this list is inserted into
1035 /// the list of logables. This allows collecting logables before invoking the method.
1036 ///
1037 /// @param logables The list of \e Logables, optionally including a domain name at the start.
1038 //==========================================================================================
1039 template <typename... BoxedObjects>
1040 void Warning( BoxedObjects&&... logables )
1041 {
1042 detail::LI::GetLogableContainer(impl).Add( std::forward<BoxedObjects>(logables)... );
1043 detail::LI::entryDetectDomainImpl( impl, Verbosity::Warning );
1044 }
1045
1046 //==========================================================================================
1047 /// Logs given logables using \alib{lox;Verbosity;Verbosity::Error}.
1048 ///
1049 /// The first object provided may be a domain name. All values are passed to
1050 /// #EntryDetectDomain. See documentation of this method for information on how to avoid
1051 /// ambiguities in respect to domain names.
1052 ///
1053 /// If one of the arguments (or a single argument given) is of type
1054 /// \alib{boxing,TBoxes}, then the contents of this list is inserted into
1055 /// the list of logables. This allows collecting logables before invoking the method.
1056 ///
1057 /// @param logables The list of \e Logables, optionally including a domain name at the start.
1058 //==========================================================================================
1059 template <typename... BoxedObjects>
1060 void Error( BoxedObjects&&... logables )
1061 {
1062 detail::LI::GetLogableContainer(impl).Add( std::forward<BoxedObjects>(logables)... );
1063 detail::LI::entryDetectDomainImpl( impl, Verbosity::Error );
1064 }
1065
1066 //==========================================================================================
1067 /// Logs given logables only if the parameter \p{condition} is not \c true.
1068 /// If executed, \alib{lox;Verbosity;Verbosity::Error} is used.
1069 ///
1070 /// The first object provided may be a domain name. All values are passed to
1071 /// #EntryDetectDomain. See documentation of this method for information on how to avoid
1072 /// ambiguities in respect to domain names.
1073 ///
1074 /// If one of the arguments (or a single argument given) is of type \alib{boxing,TBoxes},
1075 /// then the contents of this list are inserted into the list of logables. This allows
1076 /// collecting logables before invoking the method.
1077 ///
1078 /// @param condition If \c false, the <em>Log Statement</em> is executed.
1079 /// @param logables The list of \e Logables, optionally including a domain name at the start.
1080 //==========================================================================================
1081 template <typename... BoxedObjects>
1082 void Assert( bool condition, BoxedObjects&&... logables )
1083 {
1084 if (!condition )
1085 {
1086 detail::LI::GetLogableContainer(impl).Add( std::forward<BoxedObjects>(logables)... );
1087 detail::LI::entryDetectDomainImpl( impl, Verbosity::Error );
1088 }
1089 else
1091 }
1092
1093 //==========================================================================================
1094 /// Logs a list of \e Logables only if the parameter \p{condition} is \c true.
1095 ///
1096 /// \see Method #Assert.
1097 ///
1098 /// @param condition If \c false, the <em>Log Statement</em> is executed.
1099 /// @param domain Optional <em>Log Domain</em> which is combined with <em>%Scope Domains</em>
1100 /// set for the \e %Scope of invocation.
1101 /// @param verbosity The verbosity.
1102 /// @param logables The list of \e Logables.
1103 //==========================================================================================
1104 template <typename... BoxedObjects>
1105 void If( bool condition, const NString& domain, Verbosity verbosity, BoxedObjects&&... logables )
1106 {
1107 if ( condition )
1108 {
1109 detail::LI::GetLogableContainer(impl).Add( std::forward<BoxedObjects>(logables)... );
1110 detail::LI::Entry( impl, domain, verbosity );
1111 }
1112 else
1114 }
1115
1116 //==========================================================================================
1117 /// Logs a list of \e Logables only if the parameter \p{condition} is \c true.<br>
1118 ///
1119 /// This overloaded version omits parameter \p{domain}.
1120 /// The first \e logable provided may be a domain name. All values are passed to
1121 /// #EntryDetectDomain. See documentation of this method for information on how to avoid
1122 /// ambiguities in respect to domain names.
1123 ///
1124 /// If one of the arguments (or a single argument given) is of type
1125 /// \alib{boxing,TBoxes}, then the contents of this list is inserted into
1126 /// the list of logables. This allows collecting logables before invoking the method.
1127 ///
1128 /// \see Method #Assert.
1129 ///
1130 /// @param condition If \c false, the <em>Log Statement</em> is executed.
1131 /// @param verbosity The verbosity.
1132 /// @param logables The list of \e Logables.
1133 //==========================================================================================
1134 template <typename... BoxedObjects>
1135 void If( bool condition, Verbosity verbosity, BoxedObjects&&... logables )
1136 {
1137 if ( condition )
1138 {
1139 detail::LI::GetLogableContainer(impl).Add( std::forward<BoxedObjects>(logables)... );
1141 }
1142 else
1144 }
1145
1146
1147 //==========================================================================================
1148 /// Logs given \e logables once, up to \p{quantity} times, or every n-th time.
1149 /// In its simplest overloaded version, the counter is bound to the source code line, hence,
1150 /// only the first execution of this exact <em>Log Statement</em> is executed.
1151 ///
1152 /// With parameter \p{group}, a set of <em>Log Statements</em> that share the same group key,
1153 /// can be grouped and of such set, only the one which is first executed actually logs.<br>
1154 /// Alternatively, when \p{key} is omitted (or nullptr or empty), but a
1155 /// \ref alib::lox::Scope "Scope" is given with parameter \p{scope}, then the
1156 /// counter is associated with the scope.<br>
1157 /// Finally, parameters \p{key} and \p{scope} can also be used in combination. The key is
1158 /// then unique in respect to the \ref alib::lox::Scope "Scope" provided.
1159 ///
1160 /// Using, none, one or both of the parameters \p{group} and \p{scope}, among others, the
1161 /// following use cases can be achieved.
1162 /// - %Log a specific statement up to n-times.
1163 /// - %Log only the first n of a group of statements.
1164 /// - %Log only the first n statements within a method.
1165 /// - %Log only the first n statements belonging to the same group and method .
1166 /// - %Log only the first n statements within any method of
1167 /// - a source file
1168 /// - a directory of source files
1169 /// - a parent directory of source files and all sources recursively
1170 /// - %Log only the first n statements which belong to the same group and are placed within
1171 /// any method of
1172 /// - a source file
1173 /// - a directory of source files
1174 /// - a parent directory of source files and all sources recursively
1175 /// - %Log a <em>Log Statement</em> n-times per new thread.
1176 /// - %Log only the first n statements of a group of statements executed by a specific thread.
1177 ///
1178 /// When parameter \p{quantity} is a negative value, the log statement is executed every n-th time
1179 /// instead n-times. E.g, if \p{quantity} is \c -5, the first statement is executed and afterwards
1180 /// every fifth invocation.
1181 ///
1182 /// \note
1183 /// Unlike other methods of this class which accept an arbitrary amount of logables, this
1184 /// method and its overloaded variants accept only one boxed object.
1185 /// To still be able to supply several objects at once, an array of boxes or a container
1186 /// of type \alib{boxing,TBoxes} may be passed with parameter
1187 /// \p{logables}, like in the following sample:
1188 /// \snippet "ut_alox_lox.cpp" DOX_ALOX_LOX_ONCE
1189 /// This is why the parameter name \p{logables} still uses the plural with its name!
1190 ///
1191 ///
1192 /// @param domain Optional <em>Log Domain</em> which is combined with <em>%Scope Domains</em>
1193 /// set for the \e %Scope of invocation.
1194 /// @param verbosity The verbosity of the <em>Log Statement</em> (if performed).
1195 /// @param logables The objects to log (Multiple objects may be provided within
1196 /// container class Boxes.)
1197 /// @param group The optional name of the statement group . If used, all statements that
1198 /// share the same group name are working on the same counter (according
1199 /// to the \p{scope}.)
1200 /// If omitted (or empty or nullptr), the counter is bound to the \e %Scope
1201 /// provided. If omitted and \p{scope} is Scope::Global, then the
1202 /// counter is associated exclusively with the single <em>Log Statement</em> itself.
1203 /// @param scope The \e %Scope that the group or counter is bound to.
1204 /// @param quantity The number of logs to be performed. As the name of the method indicates,
1205 /// this defaults to \c 1.
1206 /// If negative, the first and every "-quantity-th" statement is executed.
1207 //==========================================================================================
1208 void Once( const NString& domain , Verbosity verbosity,
1209 const Box& logables,
1210 const String& group,
1211 Scope scope= Scope::Global,
1212 int quantity= 1)
1213 {
1214 detail::LI::once( impl, domain, verbosity, logables, group, scope, quantity );
1215 }
1216
1217 //==========================================================================================
1218 /// Overloaded version of
1219 /// \ref Once(const NString&,Verbosity,const Box&,const String&,Scope,int) "Once".
1220 ///
1221 /// @param verbosity The verbosity of the <em>Log Statement</em> (if performed).
1222 /// @param logables The objects to log (Multiple objects may be provided within
1223 /// container class Boxes.)
1224 /// @param group The optional name of the statement group . If used, all statements that
1225 /// share the same group name are working on the same counter (according
1226 /// to the \p{scope}.)
1227 /// If omitted (or empty or nullptr), the counter is bound to the \e %Scope
1228 /// provided. If omitted and \p{scope} is Scope::Global, then the
1229 /// counter is associated exclusively with the single <em>Log Statement</em> itself.
1230 /// @param scope The \e %Scope that the group or counter is bound to.
1231 /// @param quantity The number of logs to be performed. As the name of the method indicates,
1232 /// this defaults to \c 1.
1233 //==========================================================================================
1234 void Once( Verbosity verbosity, const Box& logables,
1235 const String& group,
1236 Scope scope,
1237 int quantity= 1)
1238 {
1239 detail::LI::once( impl, nullptr, verbosity, logables, group, scope, quantity );
1240 }
1241
1242 //==========================================================================================
1243 /// Overloaded version of
1244 /// \ref Once(const NString&,Verbosity,const Box&,const String&,Scope,int) "Once".
1245 ///
1246 /// @param verbosity The verbosity of the <em>Log Statement</em> (if performed).
1247 /// @param logables The objects to log (Multiple objects may be provided within
1248 /// container class Boxes.)
1249 /// @param group The optional name of the statement group . If used, all statements that
1250 /// share the same group name are working on the same counter (according
1251 /// to the \p{scope}.)
1252 /// If omitted (or empty or nullptr), the counter is bound to the \e %Scope
1253 /// provided. If omitted and \p{scope} is Scope::Global, then the
1254 /// counter is associated exclusively with the single <em>Log Statement</em> itself.
1255 /// @param quantity The number of logs to be performed. As the name of the method indicates,
1256 /// this defaults to \c 1.
1257 //==========================================================================================
1258 void Once( Verbosity verbosity, const Box& logables,
1259 const String& group,
1260 int quantity= 1)
1261 {
1262 detail::LI::once( impl, nullptr, verbosity, logables, group, Scope::Global, quantity );
1263 }
1264
1265 //==========================================================================================
1266 /// Overloaded version of
1267 /// \ref Once(const NString&,Verbosity,const Box&,const String&,Scope,int) "Once".
1268 ///
1269 /// @param verbosity The verbosity of the <em>Log Statement</em> (if performed).
1270 /// @param logables The objects to log (Multiple objects may be provided within
1271 /// container class Boxes.)
1272 /// @param quantity The number of logs to be performed. As the name of the method indicates,
1273 /// this defaults to \c 1.
1274 //==========================================================================================
1275 void Once( Verbosity verbosity, const Box& logables,
1276 int quantity= 1)
1277 {
1278 detail::LI::once( impl, nullptr, verbosity, logables, nullptr, Scope::Global, quantity );
1279 }
1280
1281 //==========================================================================================
1282 /// Overloaded version of
1283 /// \ref Once(const NString&,Verbosity,const Box&,const String&,Scope,int) "Once".
1284 ///
1285 /// @param logables The objects to log (Multiple objects may be provided within
1286 /// container class Boxes.)
1287 /// @param group The optional name of the statement group . If used, all statements that
1288 /// share the same group name are working on the same counter (according
1289 /// to the \p{scope}.)
1290 /// If omitted (or empty or nullptr), the counter is bound to the \e %Scope
1291 /// provided. If omitted and \p{scope} is Scope::Global, then the
1292 /// counter is associated exclusively with the single <em>Log Statement</em> itself.
1293 /// @param scope The \e %Scope that the group or counter is bound to.
1294 /// @param quantity The number of logs to be performed. As the name of the method indicates,
1295 /// this defaults to \c 1.
1296 //==========================================================================================
1297 void Once( const Box& logables,
1298 const String& group,
1299 Scope scope,
1300 int quantity= 1)
1301 {
1302 detail::LI::once( impl, nullptr, Verbosity::Info, logables, group, scope, quantity );
1303 }
1304
1305 //==========================================================================================
1306 /// Overloaded version of
1307 /// \ref Once(const NString&,Verbosity,const Box&,const String&,Scope,int) "Once".
1308 ///
1309 /// @param domain Optional <em>Log Domain</em> which is combined with <em>%Scope Domains</em>
1310 /// set for the \e %Scope of invocation.
1311 /// @param verbosity The verbosity of the <em>Log Statement</em> (if performed).
1312 /// @param logables The objects to log (Multiple objects may be provided within
1313 /// container class Boxes.)
1314 /// @param scope The \e %Scope that the group or counter is bound to.
1315 /// @param quantity The number of logs to be performed. As the name of the method indicates,
1316 /// this defaults to \c 1.
1317 //==========================================================================================
1318 void Once( const NString& domain, Verbosity verbosity, const Box& logables,
1319 Scope scope= Scope::Global ,
1320 int quantity= 1)
1321 {
1322 detail::LI::once( impl, domain, verbosity, logables, nullptr, scope, quantity );
1323 }
1324
1325 //==========================================================================================
1326 /// Overloaded version of
1327 /// \ref Once(const NString&,Verbosity,const Box&,const String&,Scope,int) "Once".
1328 ///
1329 /// @param verbosity The verbosity of the <em>Log Statement</em> (if performed).
1330 /// @param logables The objects to log (Multiple objects may be provided within
1331 /// container class Boxes.)
1332 /// @param scope The \e %Scope that the group or counter is bound to.
1333 /// @param quantity The number of logs to be performed. As the name of the method indicates,
1334 /// this defaults to \c 1.
1335 //==========================================================================================
1336 void Once( Verbosity verbosity, const Box& logables,
1337 Scope scope,
1338 int quantity= 1)
1339 {
1340 detail::LI::once( impl, nullptr, verbosity, logables, nullptr, scope, quantity );
1341 }
1342
1343 //==========================================================================================
1344 /// Overloaded version of
1345 /// \ref Once(const NString&,Verbosity,const Box&,const String&,Scope,int) "Once".
1346 ///
1347 /// @param logables The objects to log (Multiple objects may be provided within
1348 /// container class Boxes.)
1349 /// @param scope The \e %Scope that the group or counter is bound to.
1350 /// @param quantity The number of logs to be performed. As the name of the method indicates,
1351 /// this defaults to \c 1.
1352 //==========================================================================================
1353 void Once( const Box& logables,
1354 Scope scope,
1355 int quantity= 1)
1356 {
1357 detail::LI::once( impl, nullptr, Verbosity::Info, logables, nullptr, scope, quantity );
1358 }
1359
1360 //==========================================================================================
1361 /// Overloaded version of
1362 /// \ref Once(const NString&,Verbosity,const Box&,const String&,Scope,int) "Once".
1363 ///
1364 /// @param logables The objects to log (Multiple objects may be provided within
1365 /// container class Boxes.)
1366 /// @param quantity The number of logs to be performed. As the name of the method indicates,
1367 /// this defaults to \c 1.
1368 //==========================================================================================
1369 void Once( const Box& logables,
1370 int quantity= 1)
1371 {
1372 detail::LI::once( impl, nullptr, Verbosity::Info, logables, nullptr, Scope::Global, quantity );
1373 }
1374
1375 //==========================================================================================
1376 /// Overloaded version of
1377 /// \ref Once(const NString&,Verbosity,const Box&,const String&,Scope,int) "Once".
1378 ///
1379 /// @param logables The objects to log (Multiple objects may be provided within
1380 /// container class Boxes.)
1381 /// @param group The optional name of the statement group . If used, all statements that
1382 /// share the same group name are working on the same counter (according
1383 /// to the \p{scope}.)
1384 /// If omitted (or empty or nullptr), the counter is bound to the \e %Scope
1385 /// provided. If omitted and \p{scope} is Scope::Global, then the
1386 /// counter is associated exclusively with the single <em>Log Statement</em> itself.
1387 /// @param quantity The number of logs to be performed. As the name of the method indicates,
1388 /// this defaults to \c 1.
1389 //==========================================================================================
1390 void Once( const Box& logables,
1391 const String& group, int quantity= 1 )
1392 {
1393 detail::LI::once( impl, nullptr, Verbosity::Info, logables, group, Scope::Global, quantity );
1394 }
1395
1396 //==========================================================================================
1397 /// Returns the number of loggers attached, which are active in respect to the given
1398 /// combination of verbosity and log domain.
1399 ///
1400 /// This method may be used to avoid the execution of more complex logging code when such
1401 /// logging would not result in log activity due to the current log level settings.
1402 ///
1403 /// @param verbosity The verbosity to query for activity.
1404 /// @param domain The log domain. All rules for resolving the effective log domain
1405 /// apply as with normal log statements.<br>
1406 /// Defaults to \b NullNString.
1407 /// @return The number of active loggers.
1408 //==========================================================================================
1409 int IsActive( Verbosity verbosity, const NString& domain= NULL_NSTRING )
1410 {
1411 return detail::LI::IsActive( impl, verbosity, domain );
1412 }
1413
1414 // #############################################################################################
1415 // Debug methods
1416 // #############################################################################################
1417 #if ALIB_DEBUG_MEMORY
1418 //==========================================================================================
1419 /// Returns the internal \b MonoAllocator used for storing permanent data.
1420 ///
1421 /// \par Availability
1422 /// This method is available only with debug-builds with \ref ALIB_DEBUG_MEMORY set.
1423 ///
1424 /// @return The monotonic allocator of this \b Lox.
1425 //==========================================================================================
1430 #endif
1431
1432}; // class Lox
1433
1434namespace detail {
1435 /// Internal lox management.
1436 /// @return The current number of loxes
1438
1439 /// Internal lox management.
1441}
1442
1443} // namespace alib[::lox]
1444
1445/// Type alias in namespace \b alib.
1447
1448} // namespace [alib]
1449
1451
1452
TBoxes & Add()
Definition boxes.inl:61
This class acts as a container for Loggers and provides a convenient interface to logging.
Definition lox.inl:15
void Once(Verbosity verbosity, const Box &logables, const String &group, Scope scope, int quantity=1)
Definition lox.inl:1234
void SetPrefix(const Box &prefix, const NString &domain=nullptr, lang::Inclusion otherPLs=lang::Inclusion::Include)
Definition lox.inl:698
detail::Logger * GetLogger(const NString &loggerName)
Definition lox.inl:301
void EntryDetectDomain(Verbosity verbosity, BoxedObjects &&... logables)
Definition lox.inl:980
void Once(Verbosity verbosity, const Box &logables, Scope scope, int quantity=1)
Definition lox.inl:1336
void Entry(const NString &domain, Verbosity verbosity)
Definition lox.inl:948
ALIB_DLL ~Lox()
Destructs a lox.
Definition alox.cpp:148
void SetVerbosity(detail::Logger *logger, Verbosity verbosity, const NString &domain="/", Priority priority=Priority::Standard)
Definition lox.inl:395
integer & GetLogCounter()
Definition lox.inl:142
void Verbose(BoxedObjects &&... logables)
Definition lox.inl:1000
void MapThreadName(const String &threadName, threads::ThreadID id=0)
Definition lox.inl:775
ALIB_DLL Lox(const NString &name, bool doRegister=true)
Definition alox.cpp:140
void Once(const Box &logables, Scope scope, int quantity=1)
Definition lox.inl:1353
void ClearSourcePathTrimRules(lang::Reach reach=lang::Reach::Global, bool allowAutoRule=true)
Definition lox.inl:265
void Once(const NString &domain, Verbosity verbosity, const Box &logables, Scope scope=Scope::Global, int quantity=1)
Definition lox.inl:1318
void SetDomainSubstitutionRule(const NString &domainPath, const NString &replacement)
Definition lox.inl:541
void Once(const Box &logables, const String &group, Scope scope, int quantity=1)
Definition lox.inl:1297
void RemoveThreadDomain(const NString &scopeDomain, Scope scope, threads::Thread *thread=nullptr)
Definition lox.inl:569
void Error(BoxedObjects &&... logables)
Definition lox.inl:1060
int IsActive(Verbosity verbosity, const NString &domain=NULL_NSTRING)
Definition lox.inl:1409
void If(bool condition, const NString &domain, Verbosity verbosity, BoxedObjects &&... logables)
Definition lox.inl:1105
detail::LoxImpl * impl
The implementation.
Definition lox.inl:23
static ALIB_DLL textlogger::TextLogger * CreateConsoleLogger(const NString &name=nullptr)
Definition alox.cpp:160
void Reset()
Definition lox.inl:166
static constexpr NString InternalDomains
Definition lox.inl:47
void If(bool condition, Verbosity verbosity, BoxedObjects &&... logables)
Definition lox.inl:1135
void Once(Verbosity verbosity, const Box &logables, const String &group, int quantity=1)
Definition lox.inl:1258
void SetDomain(const NString &scopeDomain, Scope scope, threads::Thread *thread)
Definition lox.inl:477
void Acquire(const lang::CallerInfo &ci)
Definition lox.inl:149
void Warning(BoxedObjects &&... logables)
Definition lox.inl:1040
void Once(const Box &logables, const String &group, int quantity=1)
Definition lox.inl:1390
void Store(const Box &data, const NString &key, Scope scope=Scope::Global)
Definition lox.inl:807
void SetSourcePathTrimRule(const NCString &path, lang::Inclusion includeString=lang::Inclusion::Exclude, int trimOffset=0, lang::Case sensitivity=lang::Case::Ignore, const NString &trimReplacement=NULL_NSTRING, lang::Reach reach=lang::Reach::Global, Priority priority=Priority::Standard)
Definition lox.inl:236
ALIB_DLL Box Retrieve(Scope scope=Scope::Global)
Definition lox.inl:861
void SetStartTime(const FILETIME &startTime, const NString &loggerName=nullptr)
Definition lox.inl:757
const NString & GetName()
Definition lox.inl:126
void SetPrefix(const Box &prefix, Scope scope)
Definition lox.inl:637
void Info(BoxedObjects &&... logables)
Definition lox.inl:1020
void GetState(NAString &buf, StateInfo flags=StateInfo::All)
Definition lox.inl:904
void Once(const Box &logables, int quantity=1)
Definition lox.inl:1369
static ALIB_DLL void Register(Lox *lox, lang::ContainerOp operation)
Definition alox.cpp:101
void SetDomain(const NString &scopeDomain, Scope scope)
Definition lox.inl:457
detail::Logger * RemoveLogger(const NString &loggerName)
Definition lox.inl:331
void SetStartTime(time_t startTime, const NString &loggerName=nullptr)
Definition lox.inl:738
void SetVerbosity(const NString &loggerName, Verbosity verbosity, const NString &domain="/", Priority priority=Priority::Standard)
Definition lox.inl:420
void State(const NString &domain, Verbosity verbosity, const String &headLine, StateInfo flags=StateInfo::All)
Definition lox.inl:883
BoxesMA & GetLogableContainer()
Definition lox.inl:925
void Assert(bool condition, BoxedObjects &&... logables)
Definition lox.inl:1082
void Once(const NString &domain, Verbosity verbosity, const Box &logables, const String &group, Scope scope=Scope::Global, int quantity=1)
Definition lox.inl:1208
ALIB_DLL Box Retrieve(const NString &key, Scope scope=Scope::Global)
Definition lox.inl:846
void SetFileNameCacheCapacity(integer numberOfLists, integer entriesPerList)
Definition lox.inl:175
MonoAllocator & DbgGetMonoAllocator()
Definition lox.inl:1426
void Release()
Definition lox.inl:155
void Store(const Box &data, Scope scope=Scope::Global)
Definition lox.inl:820
static ALIB_DLL Lox * Get(const NString &name, lang::CreateIfNotExists create=lang::CreateIfNotExists::No)
Definition alox.cpp:79
void Once(Verbosity verbosity, const Box &logables, int quantity=1)
Definition lox.inl:1275
void SetStartTime(Ticks startTime=time::Ticks(), const NString &loggerName=nullptr)
Definition lox.inl:721
void SetPrefix(const Box &prefix, Scope scope, threads::Thread *thread)
Definition lox.inl:656
bool RemoveLogger(detail::Logger *logger)
Definition lox.inl:316
#define ALIB_DLL
Definition alib.inl:496
#define ALIB_ENUMS_MAKE_BITWISE(TEnum)
#define ALIB_EXPORT
Definition alib.inl:488
Reach
Denotes the reach of something.
@ Global
Denotes global reach.
ContainerOp
Denotes standard container operations.
CreateIfNotExists
Denotes whether something should be created if it does not exist.
Case
Denotes upper and lower case character treatment.
Inclusion
Denotes how members of a set something should be taken into account.
@ Exclude
Chooses exclusion.
@ Include
Chooses inclusion.
void shutdownLoxes()
Internal lox management.
integer dbgCountLoxes()
@ All
All flags set.
integer ThreadID
The ALib thread identifier type.
Definition thread.inl:23
constexpr NString NULL_NSTRING
A nulled string of the narrow character type.
Definition string.inl:2472
lang::integer integer
Type alias in namespace alib.
Definition integers.inl:149
strings::TString< nchar > NString
Type alias in namespace alib.
Definition string.inl:2390
strings::TAString< nchar, lang::HeapAllocator > NAString
Type alias in namespace alib.
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
strings::TCString< nchar > NCString
Type alias in namespace alib.
Definition cstring.inl:512
alib::variables::Priority Priority
Type alias in namespace alib.
boxing::Box Box
Type alias in namespace alib.
Definition box.inl:1216
lox::Lox Lox
Type alias in namespace alib.
Definition lox.inl:1446
boxing::TBoxes< MonoAllocator > BoxesMA
Type alias in namespace alib.
Definition boxes.inl:245
strings::TString< character > String
Type alias in namespace alib.
Definition string.inl:2381
time::Ticks Ticks
Type alias in namespace alib.
Definition ticks.inl:109
static ALIB_DLL void SetFileNameCacheCapacity(LoxImpl *impl, integer numberOfLists, integer entriesPerList)
static ALIB_DLL void entryDetectDomainImpl(LoxImpl *impl, Verbosity verbosity)
static ALIB_DLL void MapThreadName(LoxImpl *impl, const String &threadName, threads::ThreadID id)
static ALIB_DLL void once(LoxImpl *impl, const NString &domain, Verbosity verbosity, const Box &logables, const String &pGroup, Scope scope, int quantity)
static ALIB_DLL const NString & GetName(LoxImpl *impl)
static ALIB_DLL void Release(LoxImpl *impl)
static ALIB_DLL void SetSourcePathTrimRule(LoxImpl *impl, const NCString &path, lang::Inclusion includeString, int trimOffset, lang::Case sensitivity, const NString &trimReplacement, lang::Reach reach, Priority priority)
static ALIB_DLL void GetState(LoxImpl *impl, NAString &buf, StateInfo flags)
static ALIB_DLL void IncreaseLogCounter(LoxImpl *impl)
static ALIB_DLL integer & GetLogCounter(LoxImpl *impl)
static ALIB_DLL BoxesMA & GetLogableContainer(LoxImpl *impl)
static ALIB_DLL void Acquire(LoxImpl *impl, const lang::CallerInfo &ci)
static ALIB_DLL void SetVerbosity(LoxImpl *impl, detail::Logger *logger, Verbosity verbosity, const NString &domain, Priority priority)
static ALIB_DLL void SetPrefix(LoxImpl *impl, const Box &prefix, const NString &domain, lang::Inclusion otherPLs)
static ALIB_DLL Box retrieve(LoxImpl *impl, const NString &pKey, Scope scope)
static ALIB_DLL void setPrefix(LoxImpl *impl, const Box &prefix, Scope scope, threads::Thread *thread)
static ALIB_DLL void store(LoxImpl *impl, const Box &data, const NString &pKey, Scope scope)
static ALIB_DLL bool RemoveLogger(LoxImpl *impl, detail::Logger *logger)
static ALIB_DLL void SetStartTime(LoxImpl *impl, Ticks startTime, const NString &loggerName)
ALIB_DLL void Reset()
static ALIB_DLL void setDomain(LoxImpl *impl, const NString &scopeDomain, Scope scope, bool removeNTRSD, threads::Thread *thread)
static ALIB_DLL void Entry(LoxImpl *impl, const NString &domain, Verbosity verbosity)
static ALIB_DLL void RemoveThreadDomain(LoxImpl *impl, const NString &scopeDomain, Scope scope, threads::Thread *thread)
static ALIB_DLL void State(LoxImpl *impl, const NString &domain, Verbosity verbosity, const String &headLine, StateInfo flags)
static ALIB_DLL int IsActive(LoxImpl *impl, Verbosity verbosity, const NString &domain)
static ALIB_DLL void SetDomainSubstitutionRule(LoxImpl *impl, const NString &domainPath, const NString &replacement)
static ALIB_DLL MonoAllocator & DbgGetMonoAllocator(LoxImpl *impl)
static ALIB_DLL detail::Logger * GetLogger(LoxImpl *impl, const NString &loggerName)