Class MemoryProcessLogger
OptimaJet.Workflow.Core.Logging.MemoryProcessLogger
Provides an in-memory IProcessLogProvider that groups ProcessLogEntry instances by ProcessLogEntry.ProcessId.
Namespace: OptimaJet.Workflow.Core.Logging
public class MemoryProcessLogger : IProcessLogProviderType Hierarchy
- MemoryProcessLogger Current type
- Implemented interfaces
Constructors
public MemoryProcessLogger(int logSize, int capacity) #Creates a logger with the specified capacities for stored ProcessLogEntry instances and processes.
Parameters
Name
Type
Description
logSizeInt32The value assigned to MemoryProcessLogger.LogSize and used as the capacity of each FixedSizedQueue<T>.
capacityInt32The value assigned to MemoryProcessLogger.Capacity and checked by MemoryProcessLogger.Write(ProcessLogEntry) before a ProcessLogEntry is stored.
Properties
public int LogSize { get; } #Gets the capacity assigned to each FixedSizedQueue<T> created by MemoryProcessLogger.Write(ProcessLogEntry).
public int Capacity { get; } #Gets the configured number of process-specific FixedSizedQueue<T> instances at which MemoryProcessLogger.Write(ProcessLogEntry) begins ignoring ProcessLogEntry instances.
public ConcurrentDictionary<Guid, FixedSizedQueue<ProcessLogEntry>> ProcessLogs { get; } #Gets the in-memory storage that maps each ProcessLogEntry.ProcessId value to a FixedSizedQueue<T>.
Methods
public void Write(ProcessLogEntry entry) #Writes
entry to the provider.Parameters
Name
Type
Description
Remarks
If MemoryProcessLogger.ProcessLogs already contains at least MemoryProcessLogger.Capacity FixedSizedQueue<T> instances,
entry is ignored, including when MemoryProcessLogger.ProcessLogs already contains the instance selected by ProcessLogEntry.ProcessId. Otherwise, a new instance is created as needed. When the selected instance exceeds MemoryProcessLogger.LogSize, its oldest ProcessLogEntry instances are removed.public Task<IEnumerable<ProcessLogEntry>> ReadAllAsync(Guid processId) #Retrieves all ProcessLogEntry instances for the process identified by
processId.Parameters
Name
Type
Description
processIdGuidThe ProcessInstance.ProcessId value of the process whose ProcessLogEntry instances to retrieve.
Returns
Type
Description
Task<ProcessLogEntry>The asynchronous operation that yields all ProcessLogEntry instances associated with the process.
public Task<IEnumerable<ProcessLogEntry>> ReadLastAsync(Guid processId, DateTime time) #Parameters
Name
Type
Description
processIdGuidThe ProcessInstance.ProcessId value of the process whose ProcessLogEntry instances to retrieve.
Returns
Type
Description
Task<ProcessLogEntry>The asynchronous operation that yields the matching ProcessLogEntry instances.
public Task<IEnumerable<ProcessLogEntry>> ReadLastAsync(Guid processId, int count) #Retrieves up to
count of the most recent ProcessLogEntry instances for the process identified by processId.Parameters
Name
Type
Description
processIdGuidThe ProcessInstance.ProcessId value of the process whose ProcessLogEntry instances to retrieve.
Returns
Type
Description
Task<ProcessLogEntry>The asynchronous operation that yields up to
count of the most recent ProcessLogEntry instances, ordered from newest to oldest.public Task<IEnumerable<ProcessLogEntry>> ReadEarlyAsync(Guid processId, DateTime time, int count) #Retrieves up to
count ProcessLogEntry instances created before time for the process identified by processId.Parameters
Name
Type
Description
processIdGuidThe ProcessInstance.ProcessId value of the process whose ProcessLogEntry instances to retrieve.
Returns
Type
Description
Task<ProcessLogEntry>The asynchronous operation that yields up to
count of the matching ProcessLogEntry instances, ordered from newest to oldest.Remarks
MemoryProcessLogger.Write(ProcessLogEntry) creates each FixedSizedQueue<T> with MemoryProcessLogger.LogSize as its capacity. When MemoryProcessLogger.ProcessLogs contains at least MemoryProcessLogger.Capacity such instances, MemoryProcessLogger.Write(ProcessLogEntry) ignores the supplied ProcessLogEntry.