本文整理汇总了C#中IAppender类的典型用法代码示例。如果您正苦于以下问题:C# IAppender类的具体用法?C# IAppender怎么用?C# IAppender使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IAppender类属于命名空间,在下文中一共展示了IAppender类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitAppenders
private void InitAppenders(IAppender[] appenders)
{
for (int i = 0; i < appenders.Length; i++)
{
this.appenders[i] = appenders[i];
}
}
示例2: AddAppender
/// <summary>
/// Add an appender to a logger.
/// </summary>
/// <param name="loggerName">Name of the logger.</param>
/// <param name="appender">The appender.</param>
public static void AddAppender( string loggerName, IAppender appender )
{
ILog log = LogManager.GetLogger( loggerName );
var l = (Logger)log.Logger;
l.AddAppender( appender );
}
示例3: AddAppender
public void AddAppender(IAppender appender)
{
Hierarchy hierarchy =
(Hierarchy)LogManager.GetRepository();
hierarchy.Root.AddAppender(appender);
}
示例4: Configure
/// <summary>
/// Configures logging to a specified level, optionally directing log output to a particular
/// IAppender instance.
/// </summary>
/// <param name="verbose">If true, informational messages should be logged.</param>
/// <param name="debug">If true, diagnostic and trace-level messages should be logged.</param>
/// <param name="appender">An IAppender to which log traffic should be directed. If absent, a default
/// is used.</param>
public static void Configure(bool verbose, bool debug, IAppender appender = null)
{
if (appender != null)
{
BasicConfigurator.Configure(appender);
}
else
{
// Just take the default
BasicConfigurator.Configure();
}
var hierarchy = log4net.LogManager.GetRepository() as log4net.Repository.Hierarchy.Hierarchy;
if (debug)
{
hierarchy.Root.Level = log4net.Core.Level.Debug;
}
else if (verbose)
{
hierarchy.Root.Level = log4net.Core.Level.Info;
}
else
{
hierarchy.Root.Level = log4net.Core.Level.Error;
}
}
示例5: AddAppenders
private void AddAppenders(IAppender[] appenders)
{
foreach (IAppender appender in appenders)
{
this.Appenders.Add(appender);
}
}
示例6: Logger
public Logger(IAppender appender, IAppender appenderTwo, IAppender appenderThree)
{
this.appenders = new List<IAppender>();
this.Appenders = appender;
this.Appenders = appenderTwo;
this.Appenders = appenderThree;
}
示例7: AddAppender
/*
public static ILog MyLogger {
get {
return LogManager.GetLogger(MyLoggerName);
}
}
*/
private static void AddAppender(string loggerName, IAppender appender) {
var log = LogManager.GetLogger(loggerName);
var logger = (Logger)log.Logger;
logger.AddAppender(appender);
logger.Repository.Configured = true;
}
示例8: SetAppenderFixFlags
private void SetAppenderFixFlags(IAppender appender)
{
var bufferingAppender = appender as BufferingAppenderSkeleton;
if (bufferingAppender != null)
{
bufferingAppender.Fix = Fix;
}
}
示例9: AddAppender
public static void AddAppender(IAppender initAppender)
{
appender.Add(initAppender);
foreach (ILog aLog in log)
{
((Log)aLog).AddAppender(initAppender);
}
}
示例10: Logger
public Logger(IAppender baseapender, params IAppender[] moreappenders)
{
this.Appenders = new List<IAppender>();
this.Appenders.Add(baseapender);
foreach (var appender in moreappenders)
{
this.Appenders.Add(appender);
}
}
示例11: FallbackAppenderProxyBase
public FallbackAppenderProxyBase(IAppender appenderToWrap)
{
var convertedAppender = appenderToWrap as AppenderSkeleton;
if (convertedAppender == null)
throw new InvalidOperationException("cannot use IndefiniteAppenderProxy with an appender that does not inherit from AppenderSkeleton as it needs to hook into the IErrorHandler, to gather errors.");
innerAppender = convertedAppender;
errorHandler = new RecordingErrorHandler(GetType().Name);
convertedAppender.ErrorHandler = errorHandler;
}
示例12: AddAppender
public void AddAppender(IAppender appender)
{
int size = this.Appenders.Length;
int newSize = size + 1;
IAppender[] tmp = new IAppender[newSize];
Array.Copy(this.Appenders, 0, tmp, 0, size);
this.Appenders = tmp;
this.Appenders[newSize - 1] = appender;
}
示例13: addLogAppender
public static void addLogAppender(IAppender appender)
{
if (appender == null)
{
string msg = UException.getExceptionMessage("AppGlobal", "addLogAppender", "An IAppender object is required");
logAndThrowException(new ArgumentNullException(msg), msg);
}
loadLoggers();
log4net.Repository.Hierarchy.Logger log = (log4net.Repository.Hierarchy.Logger)logger.Logger;
log.AddAppender(appender);
}
示例14: AddAppender
protected virtual void AddAppender(IAppender profilerAppender, IAppenderAttachable logger)
{
IAppender appender;
do {
appender = logger.GetAppender(profilerAppender.Name);
if (appender != null) {
try {
logger.RemoveAppender(appender);
}
catch (Exception) { }
}
}
while (appender != null);
logger.AddAppender(profilerAppender);
}
示例15: AddAppender
/// <summary>
/// Attaches an appender.
/// </summary>
/// <param name="newAppender">The appender to add.</param>
/// <remarks>
/// If the appender is already in the list it won't be added again.
/// </remarks>
public void AddAppender(IAppender newAppender)
{
// Null values for newAppender parameter are strictly forbidden.
if (newAppender == null)
{
throw new ArgumentNullException("newAppender");
}
if (m_appenderList == null)
{
m_appenderList = new AppenderCollection(1);
}
if (!m_appenderList.Contains(newAppender))
{
m_appenderList.Add(newAppender);
}
}