コード例 #1
0
 public AsyncLogProvider(ILogProviderHost host, ILogProviderFactory factory, IConnectionParams connectParams)
 {
     this.host             = host;
     this.factory          = factory;
     this.tracer           = host.Trace;
     this.connectionParams = new ConnectionParams();
     this.connectionParams.AssignFrom(connectParams);
     this.connectionParamsReadonlyView = new ConnectionParamsReadOnlyView(this.connectionParams);
     this.stats            = new LogProviderStats();
     this.externalStats    = this.stats.Clone();
     this.threads          = host.Threads;
     this.connectionIdLazy = new Lazy <string>(() => factory.GetConnectionId(connectionParamsReadonlyView));
 }
コード例 #2
0
ファイル: AsyncLogProvider.cs プロジェクト: rkapl123/logjoint
 public AsyncLogProvider(ILogProviderHost host, ILogProviderFactory factory, IConnectionParams connectParams)
 {
     this.host             = host;
     this.factory          = factory;
     this.tracer           = host.TraceSourceFactory.CreateTraceSource("LogSource", string.Format("{0}.p", host.LoggingPrefix));
     this.connectionParams = new ConnectionParams();
     this.connectionParams.AssignFrom(connectParams);
     this.connectionParamsReadonlyView = new ConnectionParamsReadOnlyView(this.connectionParams);
     this.stats            = new LogProviderStats();
     this.externalStats    = this.stats.Clone();
     this.threads          = (ILogSourceThreadsInternal)host.Threads;
     this.connectionIdLazy = new Lazy <string>(() => factory.GetConnectionId(connectionParamsReadonlyView),
                                               LazyThreadSafetyMode.ExecutionAndPublication);
 }
コード例 #3
0
        private static Persistence.IStorageEntry CreateLogSourceSpecificStorageEntry(
            ILogProviderFactory providerFactory,
            IConnectionParams connectionParams,
            Persistence.IStorageManager storageManager
            )
        {
            var identity = providerFactory.GetConnectionId(connectionParams);

            if (string.IsNullOrWhiteSpace(identity))
            {
                throw new ArgumentException("Invalid log source identity");
            }

            // additional hash to make sure that the same log opened as
            // different formats will have different storages
            ulong numericKey = storageManager.MakeNumericKey(
                providerFactory.CompanyName + "/" + providerFactory.FormatName);

            var storageEntry = storageManager.GetEntry(identity, numericKey);

            storageEntry.AllowCleanup();             // log source specific entries can be deleted if no space is available

            return(storageEntry);
        }