Class ProcessMonitor
Implements
Inherited Members
Namespace: LemonEdge.Utils
Assembly: LemonEdge.Utils.dll
Syntax
public class ProcessMonitor : IProcessMonitor
Constructors
ProcessMonitor(ILogger, EventId)
PRIVATE. Use Create(ILogger, EventId) instead.
Declaration
public ProcessMonitor(ILogger logger, EventId eventIdForAllSteps)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | An ILogger from the consumer. |
EventId | eventIdForAllSteps | An EventId to use in logging. If provided, this is used across all the steps. |
Properties
Child
Creates a child ProcessMonitor, with the same ILogger and EventId.
Declaration
public IProcessMonitor Child { get; }
Property Value
Type | Description |
---|---|
IProcessMonitor |
Methods
ProcessAsync<T>(string, Func<Task<T>>)
Logs that a unit of code is starting. Runs that named unit of code (process). Logs that the unit of code finished, and its duration. See the ProcessMonitor class declaration for usage example.
Declaration
public Task<T> ProcessAsync<T>(string name, Func<Task<T>> process)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name / label to give the process. |
Func<Task<T>> | process | The process itself. |
Returns
Type | Description |
---|---|
Task<T> | A task of type T. |
Type Parameters
Name | Description |
---|---|
T | The type of the process. |