ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
logtools.hpp
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
9#ifndef HPP_ALOX_LOGTOOLS
10#define HPP_ALOX_LOGTOOLS 1
11
12#if !defined (HPP_ALIB_ALOX)
13 #include "alib/alox/alox.hpp"
14#endif
15
16// #################################################################################################
17// includes
18// #################################################################################################
19
20namespace alib {
21
22namespace lang { class Exception; }
23
24namespace lox {
25
26/** ************************************************************************************************
27 * Simple class with static tool functions.
28 * Currently the only functionality is logging objects of type \alib{lang;Exception}.
29 **************************************************************************************************/
31{
32 // #############################################################################################
33 // Public fields
34 // #############################################################################################
35 public:
36
37
38
39 // #############################################################################################
40 // Interface
41 // #############################################################################################
42 public:
43 /** ****************************************************************************************
44 * Logs an \b %alib::Exception. If available, the correct source information is used for
45 * each entry.
46 *
47 * Parameter \p{domainPrefix} and \p{logPrefix} are both set on outer thread scope (using
48 * \ref alib::lox::Lox::SetDomain "SetDomain( domainPrefix, Scope::ThreadOuter )" and
49 * \ref alib::lox::Lox::SetPrefix "SetPrefix( logPrefix, Scope::ThreadOuter )".
50 * The reason for this approach is that it may occur that other prefixes or scope domains
51 * are set set on source scope for the source files and methods found in the exception
52 * entry's source code information. This is especially important to understand in respect
53 * to the log domain: With the default value of parameter \p{domainPrefix} being \e "/ERR",
54 * all source related domains will appear as a sub-domain of \e "/ERR" when the exception
55 * is logged using this tool function.
56 *
57 * @param lox The lox to log into.
58 * @param e The exception to log.
59 * @param verbosity The verbosity of the log output.<br>
60 * Defaults to \b Verbosity::Error.
61 * @param domainPrefix The domain to log into. If \b NullString() , no domain is set and
62 * the default domain is used instead.<br>
63 * Defaults to \e "/ERR".
64 * @param logPrefix A log prefix string. If \b NullString() , no prefix is set<br>
65 * Defaults to <b>" "</b> (two spaces).
66 ******************************************************************************************/
68 static void Exception( Lox& lox,
69 const lang::Exception& e,
70 Verbosity verbosity = Verbosity::Error,
71 const NString& domainPrefix = "/ERR",
72 const String& logPrefix = A_CHAR(" ") );
73}; // class LogTools
74
75} // namespace alib[::lox]
76
77/// Type alias in namespace \b alib.
79
80} // namespace [alib]
81
82
83#endif // HPP_ALOX_LOGTOOLS
#define A_CHAR(STR)
#define ALIB_API
Definition alib.hpp:538
Definition alib.cpp:57
lang::Exception Exception
Type alias in namespace alib.