8#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
9# error "Symbol ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
54 while ( loxes.IsNotEmpty() )
84 for(
auto* it : detail::loxes )
92 Lox* newLox=
new Lox ( name,
false );
93 detail::loxes.emplace_back( newLox );
106 if (
lox ==
nullptr )
115 for(
auto search= detail::loxes.begin() ; search != detail::loxes.end() ; ++search )
116 if ( *search ==
lox )
118 (void) detail::loxes.erase( search );
121 ALIB_WARNING(
"ALOX",
"Given lox named \"{}\" could not be found for removal.",
122 lox !=
nullptr ?
lox->GetName() :
"<null>" )
128 for(
auto* it : detail::loxes )
129 if( it->GetName().Equals<
NC>(
lox->GetName() ) )
131 ALIB_ERROR(
"ALOX",
"Given lox named \"{}\" was already registered. "
132 "Registration ignored.",
lox->GetName() )
135 detail::loxes.emplace_back(
lox );
176 #if defined( _WIN32 )
181 ALIB_WARNING(
"ALOX",
"Unrecognized value in config variable \"{}\" = \"{}\".",
185 if( variable.
Define(variables::Priority::Standard) )
188 #if defined( _WIN32 )
209 static bool recursion=
false;
217 ALIB_WARNING(
"ALOX",
"Log::AddDebugLogger(): called twice." )
224 #if defined(_MSC_VER) && ALIB_DEBUG
227 Variable variable= variables::CampVariable( ALOX, Variables::NO_IDE_LOGGER );
228 bool createIDELogger= variable.IsNotDefined() || (variable.GetBool() == false);
232 IDELogger= new VStudioLogger(
"IDE_LOGGER");
235 lox->SetVerbosity( IDELogger, Verbosity::Verbose,
"/" );
236 lox->SetVerbosity( IDELogger, Verbosity::Warning, Lox::InternalDomains );
245 lox->SetVerbosity( DebugLogger, Verbosity::Verbose );
253 Box replacements[2]= {
"LOG",
"DEBUG_LOGGER" };
255 if( variable.IsNotDefined() )
257 (void) variable.Define();
258 variable.Get<CVVerbosities>().ExportAll=
true;
270 SetALibAssertionPlugin( lox );
282 "Log::RemoveDebugLogger(): no debug logger to remove." )
292 #if defined(_WIN32) && ALIB_DEBUG
327 std::string_view domain,
328 std::string_view msg );
333namespace {
Lox* assertionLox=
nullptr; }
339 if ( pLox ==
nullptr )
341 if ( assertionLox ==
nullptr )
345 assertionLox->GetLogableContainer().Add(
"ALoxAssertionPlugin removed "
346 "from Lox {!Q}", assertionLox->GetName() );
348 assertionLox->Release ();
349 assertionLox =
nullptr;
358 assertionLox->GetLogableContainer().Add(
"ALoxAssertionPlugin set to Lox {!Q}.", pLox->
GetName() );
366 assertionLox->Release ();
371 std::string_view domain,
372 std::string_view msg )
374 assertionLox->Acquire( ci );
376 auto& logables= assertionLox->GetLogableContainer();
379 auto verbosity= type == 0 ? Verbosity::Error :
380 type == 1 ? Verbosity::Warning :
381 type == 2 ? Verbosity::Info :
386 assertionLox->Entry( dom, verbosity );
387 assertionLox->Release ();
static ALIB_DLL textlogger::TextLogger * DebugLogger
The debug logger created by AddDebugLogger.
static ALIB_DLL void RemoveDebugLogger(Lox *lox)
static ALIB_DLL void AddDebugLogger(Lox *lox)
static ALIB_DLL void SetALibAssertionPlugin(Lox *lox)
static ALIB_DLL textlogger::TextLogger * IDELogger
An (additional) IDE specific logger, that might be created by AddDebugLogger.
This class acts as a container for Loggers and provides a convenient interface to logging.
ALIB_DLL ~Lox()
Destructs a lox.
ALIB_DLL Lox(const NString &name, bool doRegister=true)
detail::LoxImpl * impl
The implementation.
static ALIB_DLL textlogger::TextLogger * CreateConsoleLogger(const NString &name=nullptr)
static constexpr NString InternalDomains
const NString & GetName()
static ALIB_DLL void Register(Lox *lox, lang::ContainerOp operation)
static ALIB_DLL Lox * Get(const NString &name, lang::CreateIfNotExists create=lang::CreateIfNotExists::No)
constexpr bool IsEmpty() const
bool Equals(const TString< TChar > &rhs) const
TSubstring & Trim(const TCString< TChar > &whiteSpaces=CStringConstantsTraits< TChar >::DefaultWhitespaces())
ALIB_DLL bool Define(Priority requestedPriority=Priority::Standard)
#define ALIB_WARNING(domain,...)
#define ALIB_ASSERT_WARNING(cond, domain,...)
#define ALIB_ERROR(domain,...)
#define ALIB_LOCK_RECURSIVE_WITH(lock)
#define ALIB_LOCK_WITH(lock)
void(* PLUGIN)(const CallerInfo &ci, int type, std::string_view domain, std::string_view msg)
ContainerOp
Denotes standard container operations.
@ Remove
Denotes removals.
@ Insert
Denotes insertions.
CreateIfNotExists
Denotes whether something should be created if it does not exist.
@ Yes
Create if something does not exist.
void shutdownLoxes()
Internal lox management.
void ALoxAssertionPlugin(const lang::CallerInfo &ci, int type, std::string_view domain, std::string_view msg)
std::string_view const ALOX_ASSERTION_PLUGIN_DOMAIN_PREFIX
@ CONSOLE_LIGHT_COLORS
Denotes configuration variable ALOX/CONSOLE_LIGHT_COLORS used by colorful specializations of class Te...
@ CONSOLE_TYPE
Denotes configuration variable ALOX/CONSOLE_TYPE used by Lox::CreateConsoleLogger.
@ VERBOSITY
Denotes configuration variable ALOX/LOGGERNAME/VERBOSITY_WITH_LOXNAME.
@ DOMAIN_SUBSTITUTION
Denotes configuration variable ALOX/LOXNAME/DOMAIN_SUBSTITUTION used by class Lox.
@ DUMP_STATE_ON_EXIT
Denotes configuration variable ALOX/LOXNAME/DUMP_STATE_ON_EXIT used by class Lox.
@ SPTR_LOX
Denotes configuration variable ALOX/LOXNAME/SOURCE_PATH_TRIM_RULES used by class Lox.
@ PREFIXES
Denotes configuration variable ALOX/LOXNAME/PREFIXES used by class Lox.
ALIB_DLL TMonoAllocator< lang::HeapAllocator > GLOBAL_ALLOCATOR
ALIB_DLL RecursiveLock GLOBAL_ALLOCATOR_LOCK
variables::Variable CampVariable(camp::Camp &camp)
variables::Variable Variable
Type alias in namespace alib.
camp::Basecamp BASECAMP
The singleton instance of ALib Camp class Basecamp.
lox::loggers::AnsiConsoleLogger AnsiConsoleLogger
Type alias in namespace alib.
lox::loggers::ConsoleLogger ConsoleLogger
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
strings::TString< nchar > NString
Type alias in namespace alib.
lox::ALoxCamp ALOX
The singleton instance of ALib Camp class ALoxCamp.
lox::loggers::WindowsConsoleLogger WindowsConsoleLogger
Type alias in namespace alib.
boxing::Box Box
Type alias in namespace alib.
lox::Lox Lox
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
NLocalString< 256 > NString256
Type alias name for TLocalString<nchar,256>.
strings::TSubstring< character > Substring
Type alias in namespace alib.
containers::List< TAllocator, T, TRecycling > List
Type alias in namespace alib.
lox::textlogger::TextLogger TextLogger
Type alias in namespace alib.
static ALIB_DLL void Destruct(LoxImpl *lox)
static ALIB_DLL LoxImpl * Construct(const NString &name)