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