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)); }
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); }
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); }