/** **************************************************************************************** * This method is looping over the \e Loggers, checking their verbosity against the given * one, and, if they match, invoke the log method of the \e Logger. * With the first logger identified to be active, the <em>Prefix Objects</em> get * collected from the scope store. * @param dom The domain to log on * @param verbosity The verbosity. * @param logable The object to log. * @param prefixes Denotes if prefixes should be included or not. ******************************************************************************************/ protected void log( Domain dom, Verbosity verbosity, Object logable, Inclusion prefixes ) { // OK, this is a little crude, but the simplest solution: As class ScopeStore sees // null objects as nothing and won't return them in a walk, we replace null by // an object (we choose the store itself) and fix this in the loop back to null if ( logable == null ) logable= scopePrefixes; dom.CntLogCalls++; logObjects.Clear(); for ( int i= 0; i < dom.CountLoggers() ; i++ ) if( dom.IsActive( i, verbosity ) ) { // lazily collect objects once if ( logObjects.Count == 0 ) { scopePrefixes.InitWalk( Scope.ThreadInner, logable ); Object next; while( (next= scopePrefixes.Walk() ) != null ) { if ( prefixes == Inclusion.Include || next == logable) logObjects.Insert( 0, next != scopePrefixes ? next : null ); // was this the actual? then insert domain-associated logables now bool excludeOthers= false; if( next == logable ) { int qtyThreadInner= logObjects.Count -1; Domain pflDom= dom; while ( pflDom != null ) { for( int ii= pflDom.PrefixLogables.Count -1 ; ii >= 0 ; ii-- ) { Domain.PL pl= pflDom.PrefixLogables[ii]; logObjects.Insert( 0, pl.Logable ); if ( pl.IncludeOtherPLs == Inclusion.Exclude ) { excludeOthers= true; break; } } pflDom= excludeOthers ? null : pflDom.Parent; } // found a stoppable one? remove those from thread inner and break if (excludeOthers) { for ( int ii= 0; ii < qtyThreadInner ; ii++ ) logObjects.RemoveAt( logObjects.Count - 1 ); break; } } } } Logger logger= dom.GetLogger(i); logger.Acquire(); logger.CntLogs++; logger.Log( dom, verbosity, logObjects, scopeInfo ); logger.TimeOfLastLog.Set(); logger.Release(); } }