Beispiel #1
0
        public override string ToString()
        {
            string paramsStr = ConnectionParams.ToString();

            return(string.Format("<{0}\\{1}>{2}{3}",
                                 Factory.CompanyName, Factory.FormatName, string.IsNullOrEmpty(paramsStr) ? "" : " ", paramsStr));
        }
        public StreamLogProvider(
            ILogProviderHost host,
            ILogProviderFactory factory,
            IConnectionParams connectParams,
            StreamBasedFormatInfo formatInfo,
            Type readerType
            ) :
            base(host, factory, connectParams)
        {
            using (tracer.NewFrame)
            {
                tracer.Info("readerType={0}", readerType);

                if (connectionParams[ConnectionParamsKeys.RotatedLogFolderPathConnectionParam] != null)
                {
                    media = new RollingFilesMedia(
                        LogMedia.FileSystemImpl.Instance,
                        readerType,
                        formatInfo,
                        tracer,
                        new GenericRollingMediaStrategy(connectionParams[ConnectionParamsKeys.RotatedLogFolderPathConnectionParam]),
                        host.TempFilesManager,
                        host.TraceSourceFactory
                        );
                }
                else
                {
                    media = new SimpleFileMedia(connectParams);
                }

                reader = (IPositionedMessagesReader)Activator.CreateInstance(
                    readerType, new MediaBasedReaderParams(this.threads, media, host.TempFilesManager, host.TraceSourceFactory,
                                                           settingsAccessor: host.GlobalSettings, parentLoggingPrefix: tracer.Prefix), formatInfo);

                ITimeOffsets initialTimeOffset;
                if (LogJoint.TimeOffsets.TryParse(
                        connectionParams[ConnectionParamsKeys.TimeOffsetConnectionParam] ?? "", out initialTimeOffset))
                {
                    reader.TimeOffsets = initialTimeOffset;
                }

                StartAsyncReader("Reader thread: " + connectParams.ToString(), reader);

                InitPathDependentMembers(connectParams);
            }
        }
        public StreamLogProvider(
            ILogProviderHost host,
            ILogProviderFactory factory,
            IConnectionParams connectParams,
            Func <MediaBasedReaderParams, IPositionedMessagesReader> readerCreator
            ) :
            base(host, factory, connectParams)
        {
            using (tracer.NewFrame)
            {
                if (connectionParams[ConnectionParamsKeys.RotatedLogFolderPathConnectionParam] != null)
                {
                    media = new RollingFilesMedia(
                        LogMedia.FileSystemImpl.Instance,
                        readerCreator,
                        tracer,
                        new GenericRollingMediaStrategy(connectionParams[ConnectionParamsKeys.RotatedLogFolderPathConnectionParam])
                        );
                }
                else
                {
                    media = new SimpleFileMedia(connectParams);
                }

                reader = readerCreator(new MediaBasedReaderParams(this.threads, media,
                                                                  settingsAccessor: host.GlobalSettings, parentLoggingPrefix: tracer.Prefix));

                ITimeOffsets initialTimeOffset;
                if (LogJoint.TimeOffsets.TryParse(
                        connectionParams[ConnectionParamsKeys.TimeOffsetConnectionParam] ?? "", out initialTimeOffset))
                {
                    reader.TimeOffsets = initialTimeOffset;
                }

                StartAsyncReader("Reader thread: " + connectParams.ToString(), reader);

                InitPathDependentMembers(connectParams);
            }
        }
Beispiel #4
0
 public override string ToString()
 {
     return(underlyingParams.ToString());
 }