本文整理汇总了C#中ILogger.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# ILogger.Initialize方法的具体用法?C# ILogger.Initialize怎么用?C# ILogger.Initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILogger
的用法示例。
在下文中一共展示了ILogger.Initialize方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FifoLogger
static FifoLogger()
{
LogQueue = new Queue<Log>();
LockObject = new object();
ActualLogger = UnityConfig.Instance.Container.Resolve<Log4NetLogger>();
ActualLogger.Initialize(typeof(FifoLogger));
}
示例2: Main
static void Main()
{
UnityConfig.Instance.Configure();
LogConfig.Instance.LogFile = "hcs.log";
LogConfig.Instance.Configure();
FifoLogger.StartWorking();
Log = new FifoLogger();
Log.Initialize(typeof(Program));
var deviceConfigurationFile = ApplicationSettings.GetString("DeviceSettingsFile");
var configurationReader = new HcsDeviceConfigurationReader(deviceConfigurationFile);
configurationReader.Initialize();
DeviceConfigurationRegistry.Instance.Register(configurationReader);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ThreadException += Application_ThreadException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
if (ReadAuthenticationSettings())
{
ShowLoginDialog();
}
var deviceLifetimeManager = UnityConfig.Instance.Container.Resolve<DeviceLifetimeManager>();
deviceLifetimeManager.Dispose();
FifoLogger.StopWorking();
}
示例3: Setup
public void Setup()
{
_logger = new Logger();
_logger.Initialize();
_items = new List<string>();
_running = true;
var logger = _logger.Appenders.First(x => x.GetType() == typeof (FileLoggerAppender));
logger.OnLogWritten += OnLogWritten;
}
示例4: RegisterLogger
public void RegisterLogger(ILogger logger)
{
if (logger == null)
throw new ArgumentNullException ("logger");
logger.Initialize (eventSource);
loggers.Add (logger);
}
示例5: Setup
public void Setup()
{
_logger = new Logger();
_logger.Initialize(new NLoggerConfigurationSectionXmlLoader(Configuration));
}
示例6: InitializeCache
private void InitializeCache()
{
lock (s_dataLock)
{
try
{
if (_cache == null)
{
NSessionStoreProvider.s_onAppDomainUnload = new EventHandler(OnAppDomainUnload);
System.Threading.Thread.GetDomain().DomainUnload += NSessionStoreProvider.s_onAppDomainUnload;
if (_logs || _detailedLogs)
{
if (_ncacheLog == null)
{
_ncacheLog = new NCacheLogger();
_ncacheLog.Initialize(LoggerNames.SessionStoreProvider, _cacheId);
if (_detailedLogs)
{
NCacheLog.SetLevel("all");
}
else
{
if (_logs)
NCacheLog.SetLevel("info");
}
}
}
_cache = new SingleRegionCache(_operationRetry, _operationRetryInterval);
_cache.InitializeCache(_cacheId);
_cache.ExceptionsEnabled = true;
s_cacheNeedInit = false;
if(_logs) NCacheLog.Info("NSessionStoreProvider initialized");
Thread.Sleep(_inprocDelay);
}
}
catch (Exception exc)
{
_cache = null; // so that next time cache can be initialized. Check the above condition if(_cache == null)
RaiseException(exc);
}
}
}
示例7: InitializeLogger
/// <summary>
/// Initializes the logger and adds it to the list of loggers maintained by the engine.
/// This method is not expected to be called from multiple threads
/// </summary>
/// <exception cref="LoggerException">A logger exception thrown by a logger when its initialize call is made</exception>
/// <exception cref="InternalLoggerException">Any exceptions from initializing the logger which are not loggerExceptions are caught and wrapped in a InternalLoggerException</exception>
/// <exception cref="Exception">Any exception which is a ExceptionHandling.IsCriticalException will not be wrapped</exception>
private void InitializeLogger(ILogger logger, IEventSource sourceForLogger)
{
try
{
INodeLogger nodeLogger = logger as INodeLogger;
if (null != nodeLogger)
{
nodeLogger.Initialize(sourceForLogger, _maxCPUCount);
}
else
{
logger.Initialize(sourceForLogger);
}
}
catch (LoggerException)
{
throw;
}
catch (Exception e)
{
if (ExceptionHandling.IsCriticalException(e))
{
throw;
}
InternalLoggerException.Throw(e, null, "FatalErrorWhileInitializingLogger", true, logger.GetType().Name);
}
// Keep track of the loggers so they can be unregistered later on
_iloggerList.Add(logger);
}
示例8: AddLogger
/// <summary>
/// Adds the specified logger to the set of loggers for this submission.
/// </summary>
internal void AddLogger(ILogger logger)
{
lock (_syncLock)
{
if (_loggers.Contains(logger))
{
throw new InvalidOperationException("Cannot register the same logger twice.");
}
// Node loggers are central /l loggers which can understand how many CPU's the build is running with, they are only different in that
// they can take a number of CPU
INodeLogger nodeLogger = logger as INodeLogger;
if (null != nodeLogger)
{
nodeLogger.Initialize(this, _maxNodeCount);
}
else
{
logger.Initialize(this);
}
_loggers.Add(logger);
}
}
示例9: InitializeLogger
/// <summary>
/// Initialize the logger
/// </summary>
internal void InitializeLogger(List<ILogger> loggerList, ILogger logger, IEventSource sourceForLogger)
{
// Node loggers are central /l loggers which can understand how many CPU's the build is running with, they are only different in that
// they can take a number of CPU
INodeLogger nodeLogger = logger as INodeLogger;
if (null != nodeLogger)
{
nodeLogger.Initialize(sourceForLogger, 1);
}
else
{
logger.Initialize(sourceForLogger);
}
}
示例10: Initialize
/// <summary>
/// Attach the specified <see cref="ILogger"/> to this instance.
/// </summary>
/// <param name="logger">The logger.</param>
/// <exception cref="ArgumentNullException"><paramref name="logger" /> is <c>null</c>.</exception>
public void Initialize(ILogger logger)
{
if (logger == null)
{
throw new ArgumentNullException("logger");
}
logger.Initialize(this.EventSource);
}
示例11: RegisterLoggerInternal
/// <summary>
/// Initializes the logger and adds it to the list of loggers maintained by the engine
/// </summary>
/// <exception cref="LoggerException">Logger indicating it failed in a controlled way</exception>
/// <exception cref="InternalLoggerException">Logger threw arbitrary exception</exception>
private void RegisterLoggerInternal(ILogger logger, EventSource sourceForLogger, bool forwardingLogger)
{
try
{
if (logger is INodeLogger)
{
((INodeLogger)logger).Initialize(sourceForLogger, this.numberOfCpus);
}
else
{
logger.Initialize(sourceForLogger);
}
}
// Polite logger failure
catch (LoggerException)
{
throw;
}
catch (Exception e)
{
InternalLoggerException.Throw(e, null, "FatalErrorWhileInitializingLogger", false, logger.GetType().Name);
}
if (forwardingLogger)
{
if (forwardingLoggers == null)
{
forwardingLoggers = new ArrayList();
}
forwardingLoggers.Add(logger);
}
else
{
if (loggers == null)
{
loggers = new ArrayList();
}
loggers.Add(logger);
}
}
示例12: Initialize
internal void Initialize(bool throwIfRequiredPropertiesNotFoundInDefaultConfig)
{
if (currentLog == null || currentLog.IsNull)
{
DefaultConfiguration.SetProperties(this, false);
currentLog = CreateLogger(this.logType);
//if (this.logType == Naizari.Logging.LogType.MSSql)
//{
// EventManager.Current.EventStoreType = EventStoreTypes.MSSql.ToString();
//}
//else
//{
// EventManager.Current.EventStoreType = EventStoreTypes.SQLite.ToString();
//}
currentLog.Initialize();
DefaultConfiguration.SetPropertiesByProxy(currentLog, this, throwIfRequiredPropertiesNotFoundInDefaultConfig);
}
SingletonHelper.SetApplicationProvider<ILogger>(currentLog, true);
WireNotificationEvents(currentLog);
}