Пример #1
0
        /// <summary>
        /// Creates a new instance of <see cref="SendToTraceListenerExtension"/>.
        /// </summary>
        /// <param name="context">The fluent interface extesion used to configure Trace Listeners. <br/>
        /// Must implement <see cref="ILoggingConfigurationSendToExtension"/>.
        /// </param>
        protected SendToTraceListenerExtension(ILoggingConfigurationSendTo context)
        {
            extensionContext = context as ILoggingConfigurationSendToExtension;

            if (extensionContext == null) throw new ArgumentException(
                string.Format(CultureInfo.CurrentCulture, Resources.ParameterMustImplementType, typeof(ILoggingConfigurationSendToExtension)),
                "context");
        }
Пример #2
0
        /// <summary>
        /// Adds a new <see cref="XmlTraceListener"/> to the logging settings and creates
        /// a reference to this Trace Listener for the current category source.
        /// </summary>
        /// <param name="context">Fluent interface extension point.</param>
        /// <param name="listenerName">The name of the <see cref="XmlTraceListener"/>.</param>
        /// <returns>Fluent interface that can be used to further configure the created <see cref="XmlTraceListenerData"/>. </returns>
        /// <seealso cref="XmlTraceListener"/>
        /// <seealso cref="XmlTraceListenerData"/>
        public static ILoggingConfigurationSendToXmlTraceListener XmlFile(this ILoggingConfigurationSendTo context, string listenerName)
        {
            if (string.IsNullOrEmpty(listenerName))
            {
                throw new ArgumentException(Resources.ExceptionStringNullOrEmpty, "listenerName");
            }

            return(new SendToXmlTraceListenerBuilder(context, listenerName));
        }
            public SendToEmailTraceListenerBuilder(ILoggingConfigurationSendTo context, string listenerName)
                : base(context)
            {
                emailTraceListener = new EmailTraceListenerData
                {
                    Name = listenerName
                };

                base.AddTraceListenerToSettingsAndCategory(emailTraceListener);
            }
            public SendToFlatFileTraceListenerBuilder(ILoggingConfigurationSendTo context, string listenerName)
                :base(context)
            {
                flatFileTracelistenerData = new FlatFileTraceListenerData
                {
                    Name = listenerName
                };

                base.AddTraceListenerToSettingsAndCategory(flatFileTracelistenerData);
            }
            public SendToFlatFileTraceListenerBuilder(ILoggingConfigurationSendTo context, string listenerName)
                : base(context)
            {
                flatFileTracelistenerData = new FlatFileTraceListenerData
                {
                    Name = listenerName
                };

                base.AddTraceListenerToSettingsAndCategory(flatFileTracelistenerData);
            }
            public SendToDatabaseTraceListenerBuilder(ILoggingConfigurationSendTo context, string listenerName)
                : base(context)
            {
                databaseTraceListener = new FormattedDatabaseTraceListenerData
                {
                    Name = listenerName
                };

                base.AddTraceListenerToSettingsAndCategory(databaseTraceListener);
            }
            public SendToMsmqTraceListenerBuilder(ILoggingConfigurationSendTo context, string listenerName)
                :base(context)
            {
                msmqTraceListener = new MsmqTraceListenerData
                {
                    Name = listenerName
                };

                base.AddTraceListenerToSettingsAndCategory(msmqTraceListener);
            }
Пример #8
0
            public SendToSystemDiagnosticsTraceListenerBuilder(ILoggingConfigurationSendTo context, string listenerName)
                : base(context)
            {
                systemDiagnosticsData = new SystemDiagnosticsTraceListenerData()
                {
                    Name = listenerName
                };

                base.AddTraceListenerToSettingsAndCategory(systemDiagnosticsData);
            }
            public SendToFormattedEventLogTraceListenerBuilder(ILoggingConfigurationSendTo context, string listenerName)
                : base(context)
            {
                eventLogListener = new FormattedEventLogTraceListenerData
                {
                    Name = listenerName
                };

                base.AddTraceListenerToSettingsAndCategory(eventLogListener);
            }
            public SendToRollingFileTraceListenerBuilder(ILoggingConfigurationSendTo context, string listenerName)
                :base(context)
            {
                rollingTraceListenerData = new RollingFlatFileTraceListenerData()
                {
                    Name = listenerName
                };

                base.AddTraceListenerToSettingsAndCategory(rollingTraceListenerData);
            }
            public SendToRollingFileTraceListenerBuilder(ILoggingConfigurationSendTo context, string listenerName)
                : base(context)
            {
                rollingTraceListenerData = new RollingFlatFileTraceListenerData()
                {
                    Name = listenerName
                };

                base.AddTraceListenerToSettingsAndCategory(rollingTraceListenerData);
            }
Пример #12
0
        /// <summary>
        /// Creates a new instance of <see cref="SendToTraceListenerExtension"/>.
        /// </summary>
        /// <param name="context">The fluent interface extesion used to configure Trace Listeners. <br/>
        /// Must implement <see cref="ILoggingConfigurationSendToExtension"/>.
        /// </param>
        protected SendToTraceListenerExtension(ILoggingConfigurationSendTo context)
        {
            extensionContext = context as ILoggingConfigurationSendToExtension;

            if (extensionContext == null)
            {
                throw new ArgumentException(
                          string.Format(CultureInfo.CurrentCulture, Resources.ParameterMustImplementType, typeof(ILoggingConfigurationSendToExtension)),
                          "context");
            }
        }
            public SendToCustomTraceListenerBuilder(ILoggingConfigurationSendTo context, string listenerName, Type customTraceListenerType, NameValueCollection attributes)
                : base(context)
            {
                customListener = new CustomTraceListenerData()
                {
                    Name = listenerName,
                    Type = customTraceListenerType
                };

                customListener.Attributes.Add(attributes);

                base.AddTraceListenerToSettingsAndCategory(customListener);
            }
        /// <summary>
        /// Adds a new <see cref="CustomTraceListener"/> to the logging settings and creates
        /// a reference to this Trace Listener for the current category source.
        /// </summary>
        /// <param name="context">Fluent interface extension point.</param>
        /// <param name="listenerName">The name of the <see cref="CustomTraceListener"/>.</param>
        /// <param name="customTraceListenerType">The concrete type of <see cref="CustomTraceListener"/> that should be added to the configuration.</param>
        /// <param name="attributes">Attributes that should be passed to <paramref name="customTraceListenerType"/> when creating an instance.</param>
        /// <returns>Fluent interface that can be used to further configure the created <see cref="CustomTraceListenerData"/>. </returns>
        /// <seealso cref="CustomTraceListenerData"/>
        public static ILoggingConfigurationSendToCustomTraceListener Custom(this ILoggingConfigurationSendTo context, string listenerName, Type customTraceListenerType, NameValueCollection attributes)
        {
            if (string.IsNullOrEmpty(listenerName))
            {
                throw new ArgumentException(Resources.ExceptionStringNullOrEmpty, "listenerName");
            }
            if (customTraceListenerType == null)
            {
                throw new ArgumentNullException("customTraceListenerType");
            }
            if (attributes == null)
            {
                throw new ArgumentNullException("attributes");
            }

            if (!typeof(CustomTraceListener).IsAssignableFrom(customTraceListenerType))
            {
                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture,
                                                          Resources.ExceptionTypeMustDeriveFromType, typeof(CustomTraceListener)), "customTraceListenerType");
            }

            return(new SendToCustomTraceListenerBuilder(context, listenerName, customTraceListenerType, attributes));
        }
 /// <summary>
 /// Adds a new <see cref="CustomTraceListener"/> to the logging settings and creates
 /// a reference to this Trace Listener for the current category source.
 /// </summary>
 /// <typeparam name="TCustomListenerType">The concrete type of <see cref="CustomTraceListener"/> that should be added to the configuration.</typeparam>
 /// <param name="context">Fluent interface extension point.</param>
 /// <param name="listenerName">The name of the <see cref="CustomTraceListener"/>.</param>
 /// <param name="attributes">Attributes that should be passed to <typeparamref name="TCustomListenerType"/> when creating an instance.</param>
 /// <returns>Fluent interface that can be used to further configure the created <see cref="CustomTraceListenerData"/>. </returns>
 /// <seealso cref="CustomTraceListenerData"/>
 public static ILoggingConfigurationSendToCustomTraceListener Custom <TCustomListenerType>(this ILoggingConfigurationSendTo context, string listenerName, NameValueCollection attributes)
     where TCustomListenerType : CustomTraceListener
 {
     return(Custom(context, listenerName, typeof(TCustomListenerType), attributes));
 }
 /// <summary>
 /// Adds a new <see cref="CustomTraceListener"/> to the logging settings and creates
 /// a reference to this Trace Listener for the current category source.
 /// </summary>
 /// <param name="context">Fluent interface extension point.</param>
 /// <param name="listenerName">The name of the <see cref="CustomTraceListener"/>.</param>
 /// <param name="customTraceListenerType">The concrete type of <see cref="CustomTraceListener"/> that should be added to the configuration.</param>
 /// <returns>Fluent interface that can be used to further configure the created <see cref="CustomTraceListenerData"/>. </returns>
 /// <seealso cref="CustomTraceListenerData"/>
 public static ILoggingConfigurationSendToCustomTraceListener Custom(this ILoggingConfigurationSendTo context, string listenerName, Type customTraceListenerType)
 {
     return(Custom(context, listenerName, customTraceListenerType, new NameValueCollection()));
 }