6 while ( loxes.IsNotEmpty() )
35 for(
auto* it : detail::loxes )
42 Lox* newLox=
new Lox ( name,
false );
43 detail::loxes.emplace_back( newLox );
55 if (
lox ==
nullptr ) {
62 for(
auto searchIt= detail::loxes.begin() ; searchIt != detail::loxes.end() ; ++searchIt )
63 if ( *searchIt ==
lox ) {
64 (void) detail::loxes.erase( searchIt );
67 ALIB_WARNING(
"ALOX",
"Given lox named \"{}\" could not be found for removal.",
68 lox !=
nullptr ?
lox->GetName() :
"<null>" )
73 for(
auto* it : detail::loxes )
74 if( it->GetName().Equals<
NC>(
lox->GetName() ) ) {
75 ALIB_ERROR(
"ALOX",
"Given lox named \"{}\" was already registered. "
76 "Registration ignored.",
lox->GetName() )
79 detail::loxes.emplace_back(
lox );
116 #if defined( _WIN32 )
121 ALIB_WARNING(
"ALOX",
"Unrecognized value in config variable \"{}\" = \"{}\".",
125 if( variable.
Define(variables::Priority::Standard) )
128 #if defined( _WIN32 )
148 static bool recursion=
false;
155 ALIB_WARNING(
"ALOX",
"Log::AddDebugLogger(): called twice." )
162 #if defined(_MSC_VER) && ALIB_DEBUG
163 if(
BASECAMP.IsDebuggerPresent() ) {
164 Variable variable= variables::CampVariable( ALOX, Variables::NO_IDE_LOGGER );
165 bool createIDELogger= variable.IsNotDefined() || (variable.GetBool() == false);
167 if(createIDELogger) {
168 IDE_LOGGER= new VStudioLogger(
"IDE_LOGGER");
171 lox->SetVerbosity( IDE_LOGGER, Verbosity::Verbose,
"/" );
172 lox->SetVerbosity( IDE_LOGGER, Verbosity::Warning, Lox::InternalDomains );
180 lox->SetVerbosity( DEBUG_LOGGER, Verbosity::Verbose );
188 Box replacements[2]= {
"LOG",
"DEBUG_LOGGER" };
190 if( variable.IsNotDefined() ) {
191 (void) variable.Define();
192 variable.Get<CVVerbosities>().ExportAll=
true;
204 SetALibAssertionPlugin( lox );
215 "Log::RemoveDebugLogger(): no debug logger to remove." )
224 #if defined(_MSC_VER) && ALIB_DEBUG
258 std::string_view domain,
259 std::string_view msg );
264namespace {
Lox* assertionLox=
nullptr; }
270 if ( pLox ==
nullptr ) {
271 if ( assertionLox ==
nullptr )
275 assertionLox->GetLogableContainer().Add(
"ALoxAssertionPlugin removed "
276 "from Lox {!Q}", assertionLox->GetName() );
278 assertionLox->Release ();
279 assertionLox =
nullptr;
288 assertionLox->GetLogableContainer().Add(
"ALoxAssertionPlugin set to Lox {!Q}.", pLox->
GetName() );
295 assertionLox->SetVerbosity(
DEBUG_LOGGER, Verbosity::Warning,
297 assertionLox->Release ();
302 std::string_view domain,
303 std::string_view msg ) {
304 assertionLox->Acquire( ci );
306 auto& logables= assertionLox->GetLogableContainer();
309 auto verbosity= type == 0 ? Verbosity::Error :
310 type == 1 ? Verbosity::Warning :
311 type == 2 ? Verbosity::Info :
316 assertionLox->Entry( dom, verbosity );
317 assertionLox->Release ();
#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)
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)
constexpr bool IsEmpty() const
bool Equals(const TString< TChar > &rhs) const
TSubstring & Trim(const TCString< TChar > &whiteSpaces=CStringConstantsTraits< TChar >::DefaultWhitespaces())
bool Define(Priority requestedPriority=Priority::Standard)
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".
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)