/// <summary> /// Initializes a new instance of the <see cref="LogConfiguration"/> class. /// </summary> public LogConfiguration() { _sinks = new LogSinkCollection(); _assemblies = new AssemblyCollection(); _filters = new LogFilterCollection(); _internalLogger = new InternalLogger(); }
private void SerializeSinks(XmlWriter writer, LogSinkCollection sinks) { if (sinks.Count > 0) { foreach (LogSink sink in sinks) { LogSinkProxy proxy = sink as LogSinkProxy; // Make sure we got a log sink attribute. LogSinkTypeAttribute attribute = sink.GetLogSinkType(); if (attribute == null) { string message = "Cannot serialize type '{0}' since it's missing a log sink type attribute."; throw new BlackBoxException(string.Format(CultureInfo.InvariantCulture, message, sink.GetType().FullName)); } // Write the element. writer.WriteStartElement(proxy != null ? "Proxy" : "Sink"); writer.WriteAttributeString("Type", attribute.Name); // Write the name if the sink has one. if (sink.Name.IsNotNullOrEmpty()) { writer.WriteAttributeString("Name", sink.Name); } // Serialize properties. this.SerializeProperties(writer, sink); // Serialize filters. this.SerializeFilters(writer, sink.Filters); if (proxy != null) { // Serialize sinks. this.SerializeSinks(writer, proxy.Sinks); } // Write the end of the element. writer.WriteEndElement(); } } }