protected override EventListener GetListener(IListenerCreationData listenerCreationData)
        {
            ContractUtility.Requires <ArgumentNullException>(listenerCreationData.IsNotNull(), "Listener Creation Data cannot be null");
            var flatFileListenerCreationData = listenerCreationData as FlatFileListenerCreationData;

            return(FlatFileLog.CreateListener(flatFileListenerCreationData.FileName, flatFileListenerCreationData.EventTextFormatter, flatFileListenerCreationData.IsAsync));
        }
示例#2
0
        protected override EventListener GetListener(IListenerCreationData listenerCreationData)
        {
            ContractUtility.Requires <ArgumentNullException>(listenerCreationData.IsNotNull(), "Listener Creation Data cannot be null");
            var consoleListenerCreationData = listenerCreationData as ConsoleListenerCreationData;

            return(ConsoleLog.CreateListener(consoleListenerCreationData.EventTextFormatter, consoleListenerCreationData.ConsoleColorMapper));
        }
示例#3
0
        protected override EventListener GetListener(IListenerCreationData listenerCreationData)
        {
            ContractUtility.Requires <ArgumentNullException>(listenerCreationData.IsNotNull(), "Listener Creation Data cannot be null");
            var rollingFileListenerCreationData = listenerCreationData as RollingFileListenerCreationData;

            return(RollingFlatFileLog.CreateListener(rollingFileListenerCreationData.FileName, rollingFileListenerCreationData.RollSizeKB,
                                                     rollingFileListenerCreationData.TimestampPattern, rollingFileListenerCreationData.RollFileExistsBehavior,
                                                     rollingFileListenerCreationData.RollInterval, rollingFileListenerCreationData.Formatter, rollingFileListenerCreationData.MaxArchivedFiles,
                                                     rollingFileListenerCreationData.IsAsync));
        }
示例#4
0
        internal static bool CheckForPermissibleBootstrapedListenerType(ListenerData listenerData)
        {
            Type type = null;

            ContractUtility.Requires <ArgumentNullException>(_permissibleListenerCreationDataTypeForListenerType.TryGetValue(listenerData.ListenerType, out type),
                                                             "Immutable Dictionary could not get the value");
            IListenerCreationData listenerCreationData = listenerData.ListenerCreationDataAndEventSources.ListenerCreationData;

            ContractUtility.Requires <ArgumentNullException>(listenerCreationData.GetType() == type,
                                                             string.Format("For Listener Type {0}, the Listener Creation Data must be of type {1}", listenerData.ListenerType.ToString(),
                                                                           _permissibleListenerCreationDataTypeForListenerType[listenerData.ListenerType].Name));
            return(true);
        }
        public void RegisterListener(ListenerCreationDataAndEventSources listenerCreationDataAndEventSources)
        {
            ContractUtility.Requires <ArgumentNullException>(listenerCreationDataAndEventSources.IsNotNull(), "listenerCreationDataAndEventSources instance cannot be null");

            IListenerCreationData listenerCreationData = listenerCreationDataAndEventSources.ListenerCreationData;
            EventListener         eventListener        = GetListener(listenerCreationData);

            listenerCreationDataAndEventSources.EventSourcesAlongWithLevel.ToList().ForEach(x =>
            {
                eventListener.EnableEvents(x.EventSource, x.EventLevel, EventKeywords.All);
            }
                                                                                            );
        }
示例#6
0
 protected abstract EventListener GetListener(IListenerCreationData listenerCreationData);