Ejemplo n.º 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));
        }
Ejemplo n.º 2
0
 internal TraceLogManager(LogCastTraceListener listener, LogCastTraceListenerWorker worker)
 {
     if (listener == null)
     {
         throw new ArgumentNullException(nameof(listener));
     }
     _worker = worker ?? throw new ArgumentNullException(nameof(worker));
     _isTraceSourceWorker = !Trace.Listeners.Contains(listener);
 }
Ejemplo n.º 3
0
 protected override string[] GetSupportedAttributes()
 {
     return(LogCastTraceListenerWorker.GetSupportedAttributes());
 }