8#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
9# error "Configuration MACRO ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
23 import ALib.Containers.List;
26 import ALib.EnumRecords;
28 import ALib.EnumRecords.Bootstrap;
29 import ALib.Variables;
31 import ALib.Camp.Base;
32 import ALib.ALox.Impl;
51 while ( loxes.IsNotEmpty() )
80 for(
auto* it : detail::loxes )
87 Lox* newLox=
new Lox ( name,
false );
88 detail::loxes.emplace_back( newLox );
100 if (
lox ==
nullptr ) {
107 for(
auto search= detail::loxes.begin() ; search != detail::loxes.end() ; ++search )
108 if ( *search ==
lox ) {
109 (void) detail::loxes.erase( search );
112 ALIB_WARNING(
"ALOX",
"Given lox named \"{}\" could not be found for removal.",
113 lox !=
nullptr ?
lox->GetName() :
"<null>" )
118 for(
auto* it : detail::loxes )
119 if( it->GetName().Equals<
NC>(
lox->GetName() ) ) {
120 ALIB_ERROR(
"ALOX",
"Given lox named \"{}\" was already registered. "
121 "Registration ignored.",
lox->GetName() )
124 detail::loxes.emplace_back(
lox );
163 #if defined( _WIN32 )
168 ALIB_WARNING(
"ALOX",
"Unrecognized value in config variable \"{}\" = \"{}\".",
172 if( variable.
Define(variables::Priority::Standard) )
175 #if defined( _WIN32 )
195 static bool recursion=
false;
202 ALIB_WARNING(
"ALOX",
"Log::AddDebugLogger(): called twice." )
209 #if defined(_MSC_VER) && ALIB_DEBUG
210 if(
BASECAMP.IsDebuggerPresent() ) {
211 Variable variable= variables::CampVariable( ALOX, Variables::NO_IDE_LOGGER );
212 bool createIDELogger= variable.IsNotDefined() || (variable.GetBool() == false);
214 if(createIDELogger) {
215 IDELogger= new VStudioLogger(
"IDE_LOGGER");
218 lox->SetVerbosity( IDELogger, Verbosity::Verbose,
"/" );
219 lox->SetVerbosity( IDELogger, Verbosity::Warning, Lox::InternalDomains );
227 lox->SetVerbosity( DEBUG_LOGGER, Verbosity::Verbose );
235 Box replacements[2]= {
"LOG",
"DEBUG_LOGGER" };
237 if( variable.IsNotDefined() ) {
238 (void) variable.Define();
239 variable.Get<CVVerbosities>().ExportAll=
true;
251 SetALibAssertionPlugin( lox );
262 "Log::RemoveDebugLogger(): no debug logger to remove." )
271 #if defined(_WIN32) && ALIB_DEBUG
273 lox->RemoveLogger( IDELogger );
305 std::string_view domain,
306 std::string_view msg );
311namespace {
Lox* assertionLox=
nullptr; }
317 if ( pLox ==
nullptr ) {
318 if ( assertionLox ==
nullptr )
322 assertionLox->GetLogableContainer().Add(
"ALoxAssertionPlugin removed "
323 "from Lox {!Q}", assertionLox->GetName() );
325 assertionLox->Release ();
326 assertionLox =
nullptr;
335 assertionLox->GetLogableContainer().Add(
"ALoxAssertionPlugin set to Lox {!Q}.", pLox->
GetName() );
342 assertionLox->SetVerbosity(
DEBUG_LOGGER, Verbosity::Warning,
344 assertionLox->Release ();
349 std::string_view domain,
350 std::string_view msg ) {
351 assertionLox->Acquire( ci );
353 auto& logables= assertionLox->GetLogableContainer();
356 auto verbosity= type == 0 ? Verbosity::Error :
357 type == 1 ? Verbosity::Warning :
358 type == 2 ? Verbosity::Info :
363 assertionLox->Entry( dom, verbosity );
364 assertionLox->Release ();
382 || !verbVar.
Define(priority) )
388 varValue.WriteBack=
true;
#define ALIB_WARNING(domain,...)
#define ALIB_ASSERT_WARNING(cond, domain,...)
#define ALIB_ERROR(domain,...)
#define ALIB_LOCK_RECURSIVE_WITH(lock)
#define ALIB_ASSERT_ERROR(cond, domain,...)
#define ALIB_LOCK_WITH(lock)
static textlogger::TextLogger * IDE_LOGGER
An (additional) IDE specific logger, that might be created by AddDebugLogger.
static void RemoveDebugLogger(Lox *lox)
static void AddDebugLogger(Lox *lox)
static textlogger::TextLogger * DEBUG_LOGGER
The debug logger created by AddDebugLogger.
static void SetALibAssertionPlugin(Lox *lox)
This class acts as a container for Loggers and provides a convenient interface to logging.
Lox(const NString &name, bool doRegister=true)
detail::LoxImpl * impl
The implementation.
static textlogger::TextLogger * CreateConsoleLogger(const NString &name=nullptr)
static constexpr NString InternalDomains
const NString & GetName()
static void Register(Lox *lox, lang::ContainerOp operation)
static Lox * Get(const NString &name, lang::CreateIfNotExists create=lang::CreateIfNotExists::No)
bool SetVerbosityExport(Lox *lox, bool value, Priority priority=Priority::Standard)
const NString & GetName() const
constexpr bool IsEmpty() const
constexpr bool IsNotEmpty() const
bool Equals(const TString< TChar > &rhs) const
TSubstring & Trim(const TCString< TChar > &whiteSpaces=CStringConstantsTraits< TChar >::DefaultWhitespaces())
bool Define(Priority requestedPriority=Priority::Standard)
Variable & Declare(const String &name, const String &typeName, const String &defaultValue=NULL_STRING)
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 #"alxcvALOX_CONSOLE_LIGHT_COLORS" used by colorful specializations of ...
@ CONSOLE_TYPE
Denotes configuration variable #"alxcvALOX_CONSOLE_TYPE" used by #"Lox::CreateConsoleLogger;2".
@ VERBOSITY
Denotes configuration variable #"alxcvALOX_LOGGERNAME_VERBOSITY_WITH_LOXNAME".
@ DOMAIN_SUBSTITUTION
Denotes configuration variable #"alxcvALOX_LOXNAME_DOMAIN_SUBSTITUTION" used by class #"Lox".
@ DUMP_STATE_ON_EXIT
Denotes configuration variable #"alxcvALOX_LOXNAME_DUMP_STATE_ON_EXIT" used by class #"Lox".
@ SPTR_LOX
Denotes configuration variable #"alxcvALOX_LOXNAME_SOURCE_PATH_TRIM_RULES" used by class #"Lox".
@ PREFIXES
Denotes configuration variable #"alxcvALOX_LOXNAME_PREFIXES" used by class #"Lox".
RecursiveLock GLOBAL_ALLOCATOR_LOCK
TMonoAllocator< lang::HeapAllocator > GLOBAL_ALLOCATOR
variables::Variable CampVariable(camp::Camp &camp)
strings::TString< nchar > NString
Type alias in namespace alib.
lox::textlogger::TextLogger TextLogger
Type alias in namespace alib.
alib::variables::Priority Priority
Type alias in namespace alib.
variables::Variable Variable
Type alias in namespace alib.
containers::List< T, MonoAllocator, TRecycling > ListMA
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.
lang::integer integer
Type alias in namespace alib.
lox::Lox Lox
Type alias in namespace alib.
boxing::Box Box
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
strings::TSubstring< character > Substring
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.
NLocalString< 256 > NString256
Type alias name for #"TLocalString;TLocalString<nchar,256>".
lox::loggers::ConsoleLogger ConsoleLogger
Type alias in namespace alib.
static void Destruct(LoxImpl *lox)
static LoxImpl * Construct(const NString &name)