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