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)); }
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); }
protected override string[] GetSupportedAttributes() { return(LogCastTraceListenerWorker.GetSupportedAttributes()); }