/// <summary> /// Validates the configuration. /// </summary> internal void ValidateConfig() { var roots = new List <object>(); foreach (LoggingRule rule in GetLoggingRulesThreadSafe()) { roots.Add(rule); } var targetList = GetAllTargetsThreadSafe(); foreach (Target target in targetList) { roots.Add(target); } _configItems = ObjectGraphScanner.FindReachableObjects <object>(true, roots.ToArray()); // initialize all config items starting from most nested first // so that whenever the container is initialized its children have already been InternalLogger.Info("Found {0} configuration items", _configItems.Count); foreach (object o in _configItems) { PropertyHelper.CheckRequiredParameters(o); } }
/// <summary> /// Validates the configuration. /// </summary> internal void ValidateConfig() { var roots = new List <object>(); var loggingRules = this.LoggingRules.ToList(); foreach (LoggingRule rule in loggingRules) { roots.Add(rule); } var targetList = this.targets.Values.ToList(); foreach (Target target in targetList) { roots.Add(target); } this.configItems = ObjectGraphScanner.FindReachableObjects <object>(roots.ToArray()); // initialize all config items starting from most nested first // so that whenever the container is initialized its children have already been InternalLogger.Info("Found {0} configuration items", this.configItems.Length); foreach (object o in this.configItems) { PropertyHelper.CheckRequiredParameters(o); } }
/// <summary> /// Validates the configuration. /// </summary> internal void ValidateConfig() { var roots = new List <object>(); foreach (LoggingRule rule in GetLoggingRulesThreadSafe()) { roots.Add(rule); } var targetList = GetAllTargetsThreadSafe(); foreach (Target target in targetList) { roots.Add(target); } _configItems = ObjectGraphScanner.FindReachableObjects <object>(true, roots.ToArray()); InternalLogger.Info("Validating config: {0}", this); foreach (object o in _configItems) { PropertyHelper.CheckRequiredParameters(o); } }
private void FindAllLayouts() { this.allLayouts = ObjectGraphScanner.FindReachableObjects <Layout>(this); InternalLogger.Trace("{0} has {1} layouts", this, this.allLayouts.Count); this.allLayoutsAreThreadAgnostic = allLayouts.All(layout => layout.ThreadAgnostic); this.StackTraceUsage = allLayouts.DefaultIfEmpty().Max(layout => layout == null ? StackTraceUsage.None : layout.StackTraceUsage); this.scannedForLayouts = true; }
private void FindAllLayouts() { this.allLayouts = new List<Layout>(ObjectGraphScanner.FindReachableObjects<Layout>(this)); InternalLogger.Trace("{0} has {1} layouts", this, this.allLayouts.Count); bool foundNotThreadAgnostic = false; foreach (Layout layout in this.allLayouts) { if (!layout.IsThreadAgnostic) { foundNotThreadAgnostic = true; break; } } this.allLayoutsAreThreadAgnostic = !foundNotThreadAgnostic; this.scannedForLayouts = true; }
private void FindAllLayouts() { _allLayouts = ObjectGraphScanner.FindReachableObjects <Layout>(false, this); InternalLogger.Trace("{0} has {1} layouts", this, _allLayouts.Count); _allLayoutsAreThreadAgnostic = _allLayouts.All(layout => layout.ThreadAgnostic); if (!_allLayoutsAreThreadAgnostic) { _allLayoutsAreThreadSafe = _allLayouts.All(layout => layout.ThreadSafe); } else { _oneLayoutIsMutableUnsafe = _allLayouts.Any(layout => layout.MutableUnsafe); } StackTraceUsage = _allLayouts.DefaultIfEmpty().Max(layout => layout?.StackTraceUsage ?? StackTraceUsage.None); _scannedForLayouts = true; }
private static bool CanBeConvertedToLiteral(LayoutRenderer lr) { foreach (IRenderable renderable in ObjectGraphScanner.FindReachableObjects <IRenderable>(true, lr)) { if (renderable.GetType() == typeof(SimpleLayout)) { continue; } if (!renderable.GetType().IsDefined(typeof(AppDomainFixedOutputAttribute), false)) { return(false); } } return(true); }
/// <summary> /// Validates the configuration. /// </summary> internal void ValidateConfig() { var roots = new List <object>(); foreach (LoggingRule rule in GetLoggingRulesThreadSafe()) { roots.Add(rule); } var targetList = GetAllTargetsThreadSafe(); foreach (Target target in targetList) { roots.Add(target); } _configItems = ObjectGraphScanner.FindReachableObjects <object>(true, roots.ToArray()); InternalLogger.Info("Validating config: {0}", this); foreach (object o in _configItems) { try { if (o is ISupportsInitialize) { continue; // Target + Layout + LayoutRenderer validate on Initialize() } PropertyHelper.CheckRequiredParameters(o); } catch (Exception ex) { if (ex.MustBeRethrown()) { throw; } } } }
private void FindAllLayouts() { this.allLayouts = new List <Layout>(ObjectGraphScanner.FindReachableObjects <Layout>(this)); InternalLogger.Trace("{0} has {1} layouts", this, this.allLayouts.Count); this.scannedForLayouts = true; }
/// <summary> /// Initializes the target. Can be used by inheriting classes /// to initialize logging. /// </summary> protected virtual void InitializeTarget() { this.allLayouts = new List <Layout>(ObjectGraphScanner.FindReachableObjects <Layout>(this)); InternalLogger.Trace("{0} has {1} layouts", this, this.allLayouts.Count); }
private void GetAllLayouts() { allLayouts = new List <Layout>(ObjectGraphScanner.FindReachableObjects <Layout>(this)); InternalLogger.Trace("{0} has {1} layouts", this, allLayouts.Count); }