Assembly: OptimaJet.Workflow.Core

Class MemoryProcessLogger

OptimaJet.Workflow.Core.Logging.MemoryProcessLogger

Provides an in-memory IProcessLogProvider that groups ProcessLogEntry instances by ProcessLogEntry.ProcessId.

public class MemoryProcessLogger : IProcessLogProvider

Type Hierarchy

Constructors

public MemoryProcessLogger(int logSize, int capacity) #
Creates a logger with the specified capacities for stored ProcessLogEntry instances and processes.

Parameters

Name
Type
Description
logSize
Int32
The value assigned to MemoryProcessLogger.LogSize and used as the capacity of each FixedSizedQueue<T>.
capacity
Int32
The 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
entry
ProcessLogEntry
The ProcessLogEntry to write.

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
processId
Guid
The 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) #
Retrieves ProcessLogEntry instances created after time for the process identified by processId.

Parameters

Name
Type
Description
processId
Guid
The ProcessInstance.ProcessId value of the process whose ProcessLogEntry instances to retrieve.
time
DateTime
The exclusive lower bound for ProcessLogEntry.CreatedOn.

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
processId
Guid
The ProcessInstance.ProcessId value of the process whose ProcessLogEntry instances to retrieve.
count
Int32
The maximum number of 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
processId
Guid
The ProcessInstance.ProcessId value of the process whose ProcessLogEntry instances to retrieve.
time
DateTime
The exclusive upper bound for ProcessLogEntry.CreatedOn.
count
Int32
The maximum number of 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