Click or drag to resize

EventsFind Method

Finds all occurrences in the database using the passed filters

Namespace:  AskiaPortalCmn
Assembly:  AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax
public static IEnumerable<ILog> Find(
	IContext context,
	EventsFilters filters
)

Parameters

context
Type: AskiaPortalCmnIContext
Context of execution
filters
Type: AskiaPortalCmnEventsFilters
Indicates how to filters the list of logs

Return Value

Type: IEnumerableILog
Return the list of logs using the specified filters
Examples

Get the list of warnings and errors of the specified user

var context = ContextFactory.CreateForSuperAdmin();
var filters = new EventsFilters
{
    UserIds = new List<int> { context.User.Id },
    Levels =  new List<EventLevel> { EventLevel.Warning, EventLevel.Error }
};
var logs = Events.Find(context, filters);
foreach (var log in logs)
{
    Console.WriteLine($"Created At: {log.CreatedAt}, Machine: {log.MachineName}, Type: {log.Type}, Level: {log.Level}, Message: {log.Message}");
}
See Also