Exemple #1
0
        void ILogManager.InitializeEngine(ILogCastEngine engine)
        {
            if (_worker == null)
            {
                // This call insures trace listener initialization
                var listeners = _source?.Listeners ?? Trace.Listeners;
                if (listeners.Count == 0 || (listeners.Count == 1 && listeners[0] is DefaultTraceListener))
                {
                    throw new ArgumentException(
                              $"Can not find any configured trace listeners{(_source == null ? null : " in trace source " + _source.Name)}!");
                }

                var logCastListener = listeners.OfType <LogCastTraceListener>().SingleOrDefault();
                if (logCastListener == null)
                {
                    throw new InvalidOperationException(
                              $"'{typeof (LogCastTraceListener).Name}' is not configured{(_source == null ? null : " in trace source " + _source.Name)}!");
                }

                _worker = logCastListener.Worker;
                _isTraceSourceWorker = _source != null;
            }

            engine.Initialize(_worker.Options, _worker.FallbackLogger);
            engine.RegisterInspector(new ConfigurationInspector(_worker.SystemType, FrameworkName));
        }
Exemple #2
0
 void ILogManager.InitializeEngine(ILogCastEngine engine)
 {
     if (_target == null)
     {
         _target = GetTarget();
     }
     engine.Initialize(_target.Options, _target.FallbackLogger);
     engine.RegisterInspector(new ConfigurationInspector(_target.SystemType, FrameworkName));
 }
Exemple #3
0
 public void InitializeEngine(ILogCastEngine engine)
 {
     engine.Initialize(_logCastOptions, _falbackLogger);
     engine.RegisterInspector(new ConfigurationInspector(Options.SystemType, FrameworkName));
 }