private TraceListener CreateListener(IUnityContainer c) { var formatter = new TextFormatter("{message}{dictionary({key} - {value}{newline})}"); var data = new CommonLoggingEntlibTraceListenerData(this.GetType().FullName, "{listenerName}.{sourceName}", "Text Formatter"); var listener = new CommonLoggingEntlibTraceListener(data, formatter); return listener; }
///<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); }