本文整理汇总了C#中Logger.AddAcquirer方法的典型用法代码示例。如果您正苦于以下问题:C# Logger.AddAcquirer方法的具体用法?C# Logger.AddAcquirer怎么用?C# Logger.AddAcquirer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger.AddAcquirer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetVerbosity
public void SetVerbosity( Logger logger, Verbosity verbosity, String domain = "/",
int priority = Configuration.PrioDefault,
[CallerLineNumber] int cln=0,[CallerFilePath] String csf="",[CallerMemberName] String cmn="" )
{
#if ALOX_DBG_LOG || ALOX_REL_LOG
try { Acquire();
// initialize scope information
scopeInfo.Set( cln,csf,cmn, owner );
// check
if ( logger == null )
{
logInternal( Verbosity.Error, "LGR", intMsg._()
._NC( "Given Logger is \"null\". Verbosity not set." ) );
return;
}
// this might create the (path of) domain(s) and set the \e Loggers' verbosity like their
// first parent's or as given in configuration
Domain dom= evaluateResultDomain( domain );
// search logger, insert if not found
bool isNewLogger= false;
int no= dom.GetLoggerNo( logger );
if( no < 0 )
{
no= dom.AddLogger( logger );
// error, logger with same name already exists
if( no < 0 )
{
logInternal( Verbosity.Error, "LGR", intMsg._()
._NC( "Unable to add logger \"" )._NC(logger)
._NC("\". Logger with same name exists." ) );
logInternal( Verbosity.Verbose, "LGR", intMsg._()
._NC( " Request was: SetVerbosity( \"")._(logger)._NC("\", \"")
._(domain) ._NC("\", Verbosity.")
._NC(verbosity) ._NC("\", ")
._(priority) ._NC(" )." ));
Logger existingLogger= dom.GetLogger( logger.GetName() );
logInternal( Verbosity.Verbose, "LGR", intMsg._()
._NC( " Existing Logger: \"")._NC(existingLogger)._('\"') );
return;
}
// We have to register with the SmartLock facility of the \e Logger.
// But only if we have not done this yet, via the 'other' root domain tree
if ( (dom.GetRoot() == domains ? internalDomains.GetLoggerNo( logger )
: domains.GetLoggerNo( logger ) ) < 0 )
logger.AddAcquirer( this );
// store size of name to support tabular internal log output
String loggerName= logger.GetName();
if ( maxLoggerNameLength < loggerName.Length )
maxLoggerNameLength= loggerName.Length;
// for internal log
isNewLogger= true;
// remember that a logger was set after the last removal
// (for variable LOXNAME_DUMP_STATE_ON_EXIT)
loggerAddedSinceLastDebugState= true;
}
// do
dom.SetVerbosity( no, verbosity, priority );
// get verbosities from configuration
if( isNewLogger )
{
logInternal( Verbosity.Info, "LGR", intMsg._()
._("Logger \"")._( logger )
._(domain.StartsWith(ALox.InternalDomains) ?
"\" added for internal log messages." : "\" added." ) );
// we have to get all verbosities of already existing domains
Variable variable= new Variable( ALox.VERBOSITY, GetName(), logger.GetName() );
if( 0 != variable.Load() )
{
getAllVerbosities( logger, domains , variable );
getAllVerbosities( logger, internalDomains , variable );
}
}
intMsg._()._("Logger \"")._( logger.GetName() )._NC( "\":").Tab(11 + maxLoggerNameLength)
._('\'')._NC( dom.FullPath )
._( '\'' ).InsertChars(' ', maxDomainPathLength - dom.FullPath.Length() + 1 )
._( "= Verbosity." );
ALox.ToString( verbosity, priority, intMsg ).TrimEnd()._('.');
Verbosity actVerbosity= dom.GetVerbosity( no );
if( actVerbosity != verbosity )
intMsg._( " Lower priority (")._( priority )
._(" < ")._(dom.GetPriority(no))
._( "). Remains " )._NC( actVerbosity )._( '.' );
logInternal( Verbosity.Info, "LGR", intMsg );
//.........这里部分代码省略.........