public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { MonitoringDatabaseTraceListenerData castedObjectConfiguration = (MonitoringDatabaseTraceListenerData)objectConfiguration; Database database = (Database) context.HeadOfChain.BuildUp(context, typeof(Database), null, castedObjectConfiguration.ConnectionStringName); ILogFormatter formatter = LogFormatterCustomFactory.Instance.Create(context, castedObjectConfiguration.Formatter, configurationSource, reflectionCache); TraceListener createdObject = new MonitoringDatabaseTraceListener( database, formatter, castedObjectConfiguration.ApplicationName, castedObjectConfiguration.ConnectionStringName); return createdObject; }
public void Given() { listenerData = new SystemDiagnosticsTraceListenerData( "systemDiagnosticsTraceListener", typeof(MockSystemDiagsTraceListener), ""); }
///<summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// Builds a <see cref="CommonLoggingEntlibTraceListener"/> described by a /// <see cref="CommonLoggingEntlibTraceListenerData"/> configuration object. ///</summary> public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { CommonLoggingEntlibTraceListenerData data = (CommonLoggingEntlibTraceListenerData)objectConfiguration; ILogFormatter formatter = base.GetFormatter(context, data.Formatter, configurationSource, reflectionCache); CommonLoggingEntlibTraceListener listener = (CommonLoggingEntlibTraceListener)System.Activator.CreateInstance(objectConfiguration.Type, new object[] { objectConfiguration, formatter }); return listener; }
public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { XmlTraceListenerData castedObjectConfiguration = (XmlTraceListenerData)objectConfiguration; XmlTraceListener createdObject = new XmlTraceListener(castedObjectConfiguration.FileName); return createdObject; }
public void Given() { listenerData = new SystemDiagnosticsTraceListenerData( "systemDiagnosticsTraceListener", typeof(System.Diagnostics.TextWriterTraceListener), string.Empty ); }
public void Setup() { listenerData = new XmlTraceListenerData("listener", "file name") { TraceOutputOptions = TraceOptions.DateTime | TraceOptions.Callstack, Filter = SourceLevels.Warning }; }
/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// Builds a <see cref="XmlTraceListener"/> based on an instance of <see cref="XmlTraceListenerData"/>. /// </summary> /// <seealso cref="TraceListenerCustomFactory"/> /// <param name="context">The <see cref="IBuilderContext"/> that represents the current building process.</param> /// <param name="objectConfiguration">The configuration object that describes the object to build. Must be an instance of <see cref="XmlTraceListenerData"/>.</param> /// <param name="configurationSource">The source for configuration objects.</param> /// <param name="reflectionCache">The cache to use retrieving reflection information.</param> /// <returns>A fully initialized instance of <see cref="XmlTraceListener"/>.</returns> public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { XmlTraceListenerData castedObjectConfiguration = (XmlTraceListenerData)objectConfiguration; XmlTraceListener createdObject = new XmlTraceListener(castedObjectConfiguration.FileName); return createdObject; }
/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// Builds a <see cref="TraceListener"/> based on an instance of <see cref="SystemDiagnosticsTraceListenerData"/>. /// </summary> /// <remarks> /// The building process for non Enterprise Library specific <see cref="TraceListener"/>s mimics the creation process used by System.Diagnostics' configuration. /// </remarks> /// <seealso cref="TraceListenerCustomFactory"/> /// <param name="context">The <see cref="IBuilderContext"/> that represents the current building process.</param> /// <param name="objectConfiguration">The configuration object that describes the object to build. Must be an instance of <see cref="SystemDiagnosticsTraceListenerData"/>.</param> /// <param name="configurationSource">The source for configuration objects.</param> /// <param name="reflectionCache">The cache to use retrieving reflection information.</param> /// <returns>A fully initialized instance of a <see cref="TraceListener"/> subclass.</returns> public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { BasicCustomTraceListenerData castedObjectConfiguration = (BasicCustomTraceListenerData)objectConfiguration; Type type = castedObjectConfiguration.Type; string name = castedObjectConfiguration.Name; TraceOptions traceOutputOptions = castedObjectConfiguration.TraceOutputOptions; string initData = castedObjectConfiguration.InitData; NameValueCollection attributes = castedObjectConfiguration.Attributes; TraceListener traceListener = null; if (String.IsNullOrEmpty(initData)) { ConstructorInfo defaultConstructor = type.GetConstructor(Type.EmptyTypes); if (defaultConstructor != null) { traceListener = (TraceListener)defaultConstructor.Invoke(emptyParameters); } else { throw new InvalidOperationException( string.Format(Resources.Culture, Resources.ExceptionCustomListenerTypeDoesNotHaveDefaultConstructor, name, type.FullName)); } } else { try { traceListener = (TraceListener)Activator.CreateInstance(type, initData); } catch (MissingMethodException exception) { throw new InvalidOperationException( string.Format( Resources.Culture, Resources.ExceptionCustomTraceListenerTypeDoesNotHaveRequiredConstructor, name, type.FullName), exception); } } foreach (string attribute in attributes.Keys) { traceListener.Attributes.Add(attribute, attributes.Get(attribute)); } return(traceListener); }
public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { BasicCustomTraceListenerData castedObjectConfiguration = (BasicCustomTraceListenerData)objectConfiguration; Type type = castedObjectConfiguration.Type; string name = castedObjectConfiguration.Name; TraceOptions traceOutputOptions = castedObjectConfiguration.TraceOutputOptions; string initData = castedObjectConfiguration.InitData; NameValueCollection attributes = castedObjectConfiguration.Attributes; return(SystemDiagnosticsTraceListenerCreationHelper.CreateSystemDiagnosticsTraceListener(name, type, initData, attributes)); }
/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// Builds a <see cref="TraceListener"/> based on an instance of <see cref="SystemDiagnosticsTraceListenerData"/>. /// </summary> /// <remarks> /// The building process for non Enterprise Library specific <see cref="TraceListener"/>s mimics the creation process used by System.Diagnostics' configuration. /// </remarks> /// <seealso cref="TraceListenerCustomFactory"/> /// <param name="context">The <see cref="IBuilderContext"/> that represents the current building process.</param> /// <param name="objectConfiguration">The configuration object that describes the object to build. Must be an instance of <see cref="SystemDiagnosticsTraceListenerData"/>.</param> /// <param name="configurationSource">The source for configuration objects.</param> /// <param name="reflectionCache">The cache to use retrieving reflection information.</param> /// <returns>A fully initialized instance of a <see cref="TraceListener"/> subclass.</returns> public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { BasicCustomTraceListenerData castedObjectConfiguration = (BasicCustomTraceListenerData)objectConfiguration; Type type = castedObjectConfiguration.Type; string name = castedObjectConfiguration.Name; TraceOptions traceOutputOptions = castedObjectConfiguration.TraceOutputOptions; string initData = castedObjectConfiguration.InitData; NameValueCollection attributes = castedObjectConfiguration.Attributes; TraceListener traceListener = null; if (String.IsNullOrEmpty(initData)) { ConstructorInfo defaultConstructor = type.GetConstructor(Type.EmptyTypes); if (defaultConstructor != null) { traceListener = (TraceListener)defaultConstructor.Invoke(emptyParameters); } else { throw new InvalidOperationException( string.Format(Resources.Culture, Resources.ExceptionCustomListenerTypeDoesNotHaveDefaultConstructor, name, type.FullName)); } } else { try { traceListener = (TraceListener)Activator.CreateInstance(type, initData); } catch (MissingMethodException exception) { throw new InvalidOperationException( string.Format( Resources.Culture, Resources.ExceptionCustomTraceListenerTypeDoesNotHaveRequiredConstructor, name, type.FullName), exception); } } foreach (string attribute in attributes.Keys) { traceListener.Attributes.Add(attribute, attributes.Get(attribute)); } return traceListener; }
public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { TraceListener createdObject = base.Assemble(context, objectConfiguration, configurationSource, reflectionCache); if (createdObject is CustomTraceListener) { CustomTraceListenerData castedObjectConfiguration = (CustomTraceListenerData)objectConfiguration; ILogFormatter formatter = GetFormatter(context, castedObjectConfiguration.Formatter, configurationSource, reflectionCache); ((CustomTraceListener)createdObject).Formatter = formatter; } return(createdObject); }
public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { FlatFileTraceListenerData castedObjectConfiguration = (FlatFileTraceListenerData)objectConfiguration; ILogFormatter formatter = GetFormatter(context, castedObjectConfiguration.Formatter, configurationSource, reflectionCache); TraceListener createdObject = new FlatFileTraceListener( castedObjectConfiguration.FileName, castedObjectConfiguration.Header, castedObjectConfiguration.Footer, formatter); return(createdObject); }
/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// Builds a custom trace listener based on an instance of <see cref="CustomTraceListenerData"/>. /// </summary> /// <seealso cref="TraceListenerCustomFactory"/> /// <param name="context">The <see cref="IBuilderContext"/> that represents the current building process.</param> /// <param name="objectConfiguration">The configuration object that describes the object to build. Must be an instance of <see cref="CustomTraceListenerData"/>.</param> /// <param name="configurationSource">The source for configuration objects.</param> /// <param name="reflectionCache">The cache to use retrieving reflection information.</param> /// <returns>A fully initialized custom trace listener.</returns> public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { TraceListener createdObject = base.Assemble(context, objectConfiguration, configurationSource, reflectionCache); if (createdObject is CustomTraceListener) { CustomTraceListenerData castedObjectConfiguration = (CustomTraceListenerData)objectConfiguration; ILogFormatter formatter = GetFormatter(context, castedObjectConfiguration.Formatter, configurationSource, reflectionCache); ((CustomTraceListener)createdObject).Formatter = formatter; } return createdObject; }
/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// Builds a <see cref="FlatFileTraceListener"/> based on an instance of <see cref="FlatFileTraceListenerData"/>. /// </summary> /// <seealso cref="TraceListenerCustomFactory"/> /// <param name="context">The <see cref="IBuilderContext"/> that represents the current building process.</param> /// <param name="objectConfiguration">The configuration object that describes the object to build. Must be an instance of <see cref="FlatFileTraceListenerData"/>.</param> /// <param name="configurationSource">The source for configuration objects.</param> /// <param name="reflectionCache">The cache to use retrieving reflection information.</param> /// <returns>A fully initialized instance of <see cref="FlatFileTraceListener"/>.</returns> public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { FlatFileTraceListenerData castedObjectConfiguration = (FlatFileTraceListenerData)objectConfiguration; ILogFormatter formatter = GetFormatter(context, castedObjectConfiguration.Formatter, configurationSource, reflectionCache); TraceListener createdObject = new FlatFileTraceListener( castedObjectConfiguration.FileName, castedObjectConfiguration.Header, castedObjectConfiguration.Footer, formatter); return createdObject; }
/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// Builds an <see cref="EmailTraceListener"/> based on an instance of <see cref="EmailTraceListenerData"/>. /// </summary> /// <seealso cref="TraceListenerCustomFactory"/> /// <param name="context">The <see cref="IBuilderContext"/> that represents the current building process.</param> /// <param name="objectConfiguration">The configuration object that describes the object to build. Must be an instance of <see cref="EmailTraceListenerData"/>.</param> /// <param name="configurationSource">The source for configuration objects.</param> /// <param name="reflectionCache">The cache to use retrieving reflection information.</param> /// <returns>A fully initialized instance of <see cref="EmailTraceListener"/>.</returns> public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { EmailTraceListenerData castedObjectConfiguration = (EmailTraceListenerData)objectConfiguration; ILogFormatter formatter = GetFormatter(context, castedObjectConfiguration.Formatter, configurationSource, reflectionCache); TraceListener createdObject = new EmailTraceListener( castedObjectConfiguration.ToAddress, castedObjectConfiguration.FromAddress, castedObjectConfiguration.SubjectLineStarter, castedObjectConfiguration.SubjectLineEnder, castedObjectConfiguration.SmtpServer, castedObjectConfiguration.SmtpPort, formatter); return createdObject; }
/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// Builds an <see cref="EmailTraceListener"/> based on an instance of <see cref="EmailTraceListenerData"/>. /// </summary> /// <seealso cref="TraceListenerCustomFactory"/> /// <param name="context">The <see cref="IBuilderContext"/> that represents the current building process.</param> /// <param name="objectConfiguration">The configuration object that describes the object to build. Must be an instance of <see cref="EmailTraceListenerData"/>.</param> /// <param name="configurationSource">The source for configuration objects.</param> /// <param name="reflectionCache">The cache to use retrieving reflection information.</param> /// <returns>A fully initialized instance of <see cref="EmailTraceListener"/>.</returns> public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { EmailTraceListenerData castedObjectConfiguration = (EmailTraceListenerData)objectConfiguration; ILogFormatter formatter = GetFormatter(context, castedObjectConfiguration.Formatter, configurationSource, reflectionCache); TraceListener createdObject = new EmailTraceListener( castedObjectConfiguration.ToAddress, castedObjectConfiguration.FromAddress, castedObjectConfiguration.SubjectLineStarter, castedObjectConfiguration.SubjectLineEnder, castedObjectConfiguration.SmtpServer, castedObjectConfiguration.SmtpPort, formatter); return(createdObject); }
public void Setup() { listenerData = new RollingFlatFileTraceListenerData( "listener", "file name", "header", "footer", 100, "timestamp pattern", RollFileExistsBehavior.Increment, RollInterval.Day, TraceOptions.DateTime | TraceOptions.Callstack, "formatter") { Filter = SourceLevels.Warning, MaxArchivedFiles = 100 }; }
/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// Builds a <see cref="FormattedDatabaseTraceListener"/> based on an instance of <see cref="FormattedDatabaseTraceListenerData"/>. /// </summary> /// <seealso cref="TraceListenerCustomFactory"/> /// <param name="context">The <see cref="IBuilderContext"/> that represents the current building process.</param> /// <param name="objectConfiguration">The configuration object that describes the object to build. Must be an instance of <see cref="FormattedDatabaseTraceListenerData"/>.</param> /// <param name="configurationSource">The source for configuration objects.</param> /// <param name="reflectionCache">The cache to use retrieving reflection information.</param> /// <returns>A fully initialized instance of <see cref="FormattedDatabaseTraceListener"/>.</returns> public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { FormattedDatabaseTraceListenerData castedObjectConfiguration = (FormattedDatabaseTraceListenerData)objectConfiguration; Data.Database database = (Data.Database)context.HeadOfChain.BuildUp(context, typeof(Data.Database), null, castedObjectConfiguration.DatabaseInstanceName); ILogFormatter formatter = LogFormatterCustomFactory.Instance.Create(context, castedObjectConfiguration.Formatter, configurationSource, reflectionCache); TraceListener createdObject = new FormattedDatabaseTraceListener( database, castedObjectConfiguration.WriteLogStoredProcName, castedObjectConfiguration.AddCategoryStoredProcName, formatter); return createdObject; }
/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// Builds a <see cref="FlatFileTraceListener"/> based on an instance of <see cref="FlatFileTraceListenerData"/>. /// </summary> /// <seealso cref="TraceListenerCustomFactory"/> /// <param name="context">The <see cref="IBuilderContext"/> that represents the current building process.</param> /// <param name="objectConfiguration">The configuration object that describes the object to build. Must be an instance of <see cref="FlatFileTraceListenerData"/>.</param> /// <param name="configurationSource">The source for configuration objects.</param> /// <param name="reflectionCache">The cache to use retrieving reflection information.</param> /// <returns>A fully initialized instance of <see cref="FlatFileTraceListener"/>.</returns> public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { RollingFlatFileTraceListenerData castObjectConfiguration = (RollingFlatFileTraceListenerData)objectConfiguration; ILogFormatter formatter = GetFormatter(context, castObjectConfiguration.Formatter, configurationSource, reflectionCache); RollingFlatFileTraceListener createdObject = new RollingFlatFileTraceListener( castObjectConfiguration.FileName, castObjectConfiguration.Header, castObjectConfiguration.Footer, formatter, castObjectConfiguration.RollSizeKB, castObjectConfiguration.TimeStampPattern, castObjectConfiguration.RollFileExistsBehavior, castObjectConfiguration.RollInterval ); return(createdObject); }
/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// Builds a <see cref="MsmqTraceListener"/> based on an instance of <see cref="MsmqTraceListenerData"/>. /// </summary> /// <seealso cref="TraceListenerCustomFactory"/> /// <param name="context">The <see cref="IBuilderContext"/> that represents the current building process.</param> /// <param name="objectConfiguration">The configuration object that describes the object to build. Must be an instance of <see cref="MsmqTraceListenerData"/>.</param> /// <param name="configurationSource">The source for configuration objects.</param> /// <param name="reflectionCache">The cache to use retrieving reflection information.</param> /// <returns>A fully initialized instance of <see cref="MsmqTraceListener"/>.</returns> public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { MsmqTraceListenerData castedObjectConfiguration = (MsmqTraceListenerData)objectConfiguration; ILogFormatter formatter = GetFormatter(context, castedObjectConfiguration.Formatter, configurationSource, reflectionCache); TraceListener createdObject = new MsmqTraceListener( castedObjectConfiguration.Name, castedObjectConfiguration.QueuePath, formatter, castedObjectConfiguration.MessagePriority, castedObjectConfiguration.Recoverable, castedObjectConfiguration.TimeToReachQueue, castedObjectConfiguration.TimeToBeReceived, castedObjectConfiguration.UseAuthentication, castedObjectConfiguration.UseDeadLetterQueue, castedObjectConfiguration.UseEncryption, castedObjectConfiguration.TransactionType); return createdObject; }
/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// Builds a <see cref="MsmqTraceListener"/> based on an instance of <see cref="MsmqTraceListenerData"/>. /// </summary> /// <seealso cref="TraceListenerCustomFactory"/> /// <param name="context">The <see cref="IBuilderContext"/> that represents the current building process.</param> /// <param name="objectConfiguration">The configuration object that describes the object to build. Must be an instance of <see cref="MsmqTraceListenerData"/>.</param> /// <param name="configurationSource">The source for configuration objects.</param> /// <param name="reflectionCache">The cache to use retrieving reflection information.</param> /// <returns>A fully initialized instance of <see cref="MsmqTraceListener"/>.</returns> public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { MsmqTraceListenerData castedObjectConfiguration = (MsmqTraceListenerData)objectConfiguration; ILogFormatter formatter = GetFormatter(context, castedObjectConfiguration.Formatter, configurationSource, reflectionCache); TraceListener createdObject = new MsmqTraceListener( castedObjectConfiguration.Name, castedObjectConfiguration.QueuePath, formatter, castedObjectConfiguration.MessagePriority, castedObjectConfiguration.Recoverable, castedObjectConfiguration.TimeToReachQueue, castedObjectConfiguration.TimeToBeReceived, castedObjectConfiguration.UseAuthentication, castedObjectConfiguration.UseDeadLetterQueue, castedObjectConfiguration.UseEncryption, castedObjectConfiguration.TransactionType); return(createdObject); }
public void Given() { listenerData = new WmiTraceListenerData("listener") { TraceOutputOptions = TraceOptions.Callstack | TraceOptions.ProcessId }; }
/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// Builds a <see cref="WmiTraceListener"/> based on an instance of <see cref="WmiTraceListenerData"/>. /// </summary> /// <seealso cref="TraceListenerCustomFactory"/> /// <param name="context">The <see cref="IBuilderContext"/> that represents the current building process.</param> /// <param name="objectConfiguration">The configuration object that describes the object to build. Must be an instance of <see cref="WmiTraceListenerData"/>.</param> /// <param name="configurationSource">The source for configuration objects.</param> /// <param name="reflectionCache">The cache to use retrieving reflection information.</param> /// <returns>A fully initialized instance of <see cref="WmiTraceListener"/>.</returns> public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { return new WmiTraceListener(); }
public void Setup() { listenerData = new WmiTraceListenerData("listener"); }
public void Setup() { listenerData = new WmiTraceListenerData("listener") { Filter = SourceLevels.Warning }; }
/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// Builds a <see cref="FlatFileTraceListener"/> based on an instance of <see cref="FlatFileTraceListenerData"/>. /// </summary> /// <seealso cref="TraceListenerCustomFactory"/> /// <param name="context">The <see cref="IBuilderContext"/> that represents the current building process.</param> /// <param name="objectConfiguration">The configuration object that describes the object to build. Must be an instance of <see cref="FlatFileTraceListenerData"/>.</param> /// <param name="configurationSource">The source for configuration objects.</param> /// <param name="reflectionCache">The cache to use retrieving reflection information.</param> /// <returns>A fully initialized instance of <see cref="FlatFileTraceListener"/>.</returns> public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { RollingFlatFileTraceListenerData castObjectConfiguration = (RollingFlatFileTraceListenerData)objectConfiguration; ILogFormatter formatter = GetFormatter(context, castObjectConfiguration.Formatter, configurationSource, reflectionCache); RollingFlatFileTraceListener createdObject = new RollingFlatFileTraceListener( castObjectConfiguration.FileName, castObjectConfiguration.Header, castObjectConfiguration.Footer, formatter, castObjectConfiguration.RollSizeKB, castObjectConfiguration.TimeStampPattern, castObjectConfiguration.RollFileExistsBehavior, castObjectConfiguration.RollInterval ); return createdObject; }
public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache) { return(new WmiTraceListener()); }
/// <summary> /// Adds a <see cref="TraceListenerData"/> instance to the logging settings and adds a <see cref="TraceListenerReferenceData"/> to the current Category Source. /// </summary> /// <param name="traceListenerData">The <see cref="TraceListenerData"/> that sould be added to configuration.</param> protected void AddTraceListenerToSettingsAndCategory(TraceListenerData traceListenerData) { extensionContext.LoggingSettings.TraceListeners.Add(traceListenerData); extensionContext.CurrentTraceSource.TraceListeners.Add(new TraceListenerReferenceData(traceListenerData.Name)); }