Exemplo n.º 1
0
 /// <summary>
 /// Creates node with defined configuration data.
 /// </summary>
 /// <param name="formatters">The defined configuration data.</param>
 public FormatterCollectionNode(FormatterDataCollection formatters) : base()
 {
     if (formatters == null)
     {
         throw new ArgumentNullException("formatters");
     }
     this.formatterDataCollection = formatters;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the <see cref="FormatterData"></see> defined for the named logging formatter
        /// </summary>
        /// <param name="formatterName">Name of the logging formatter to retrieve</param>
        /// <returns><see cref="FormatterData"></see> defined for named logging formatter</returns>
        public FormatterData GetFormatterData(string formatterName)
        {
            ArgumentValidation.CheckForNullReference(formatterName, "formatterName");
            ArgumentValidation.CheckForEmptyString(formatterName, "formatterName");

            DistributorSettings     settings = GetDistributorSettings();
            FormatterDataCollection formatterDataCollection = settings.Formatters;

            // it is ok for a formatter to be null
            return(formatterDataCollection[formatterName]);
        }
Exemplo n.º 3
0
        private void GetFormatters()
        {
            FormatterCollectionNode formatterCollectionNode = Hierarchy.FindNodeByType(this, typeof(FormatterCollectionNode)) as FormatterCollectionNode;

            if (formatterCollectionNode == null)
            {
                return;
            }

            FormatterDataCollection formatters = formatterCollectionNode.FormatterDataCollection;

            if (Object.ReferenceEquals(distributorSettings.Formatters, formatters))
            {
                return;
            }

            distributorSettings.Formatters.Clear();
            foreach (FormatterData formatterData in formatters)
            {
                distributorSettings.Formatters[formatterData.Name] = formatterData;
            }
        }