3using System.Reflection;
5using System.Threading.Tasks;
30 [Page(7,
"Time", 150)]
32 [ToolTip(9,
"Search for events from this point in time.")]
33 public DateTime From = DateTime.Today.AddDays(-1);
35 [Page(7,
"Time", 150)]
37 [ToolTip(11,
"Search for events to this point in time.")]
38 public DateTime To = DateTime.Today.AddDays(1);
66 return Task.CompletedTask;
76 if (this.To < this.From)
78 DateTime Temp = this.To;
83 List<Filter> Filters =
new List<Filter>();
84 if (this.From > DateTime.MinValue)
87 if (this.To < DateTime.MaxValue)
92 IEnumerable<EventStatistic> Records = Filters.Count
switch
95 1 => await
Database.
Find<EventStatistic>(Filters[0],
"Timestamp"),
102 await this.ReportRecords(Records,
Query,
Language,
"PerLevel",
105 await this.ReportRecords(Records,
Query,
Language,
"PerEventId",
108 await this.ReportRecords(Records,
Query,
Language,
"PerActor",
111 await this.ReportRecords(Records,
Query,
Language,
"PerModule",
114 await this.ReportRecords(Records,
Query,
Language,
"PerFacility",
130 string Property,
string SectionName)
132 SortedDictionary<string, int> Labels =
new SortedDictionary<string, int>();
133 PropertyInfo PI = typeof(EventStatistic).GetProperty(Property);
136 foreach (EventStatistic Rec
in Records)
138 foreach (Statistic Stat
in (Statistic[])PI.GetValue(Rec))
140 if (!Labels.ContainsKey(Stat.Name))
141 Labels[Stat.Name] = i++;
145 List<Column> Columns =
new List<Column>()
153 SortedDictionary<string, int> IndexByName =
new SortedDictionary<string, int>();
156 foreach (KeyValuePair<string, int> Header
in Labels)
159 IndexByName[
Header.Key] = i++;
162 int c = Columns.Count;
165 await
Query.
NewTable(Property, SectionName, Columns.ToArray());
167 foreach (EventStatistic Rec
in Records)
169 object[]
Record =
new object[c];
171 Record[1] = Rec.Timestamp;
173 foreach (Statistic Stat
in (Statistic[])PI.GetValue(Rec))
175 if (IndexByName.TryGetValue(Stat.Name, out i))
188 SortedDictionary<string, int> Labels =
new SortedDictionary<string, int>();
191 foreach (EventStatistic Rec
in Records)
193 foreach (Statistic Stat
in Rec.PerStackTrace)
195 if (!Labels.ContainsKey(Stat.Name))
196 Labels[Stat.Name] = i++;
200 List<Column> Columns =
new List<Column>()
216 foreach (
string StackTrace
in Labels.Keys)
218 StringBuilder Markdown =
new StringBuilder();
220 Markdown.AppendLine(
"```");
221 Markdown.AppendLine(StackTrace);
222 Markdown.AppendLine(
"```");
226 string TableId =
"T" + i++.ToString();
228 await
Query.
NewTable(TableId, StackTraceLabel +
" " + i.ToString(), Columns.ToArray());
230 foreach (EventStatistic Rec
in Records)
232 object[]
Record =
new object[]
239 foreach (Statistic Stat
in Rec.PerStackTrace)
241 if (Stat.Name == StackTrace)
Class that can be used to encapsulate Markdown to be returned from a Web Service, bypassing any encod...
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static Task< IEnumerable< object > > Find(string Collection, params string[] SortOrder)
Finds objects in a given collection.
This filter selects objects that conform to all child-filters provided.
This filter selects objects that have a named field greater or equal to a given value.
This filter selects objects that have a named field lesser or equal to a given value.
ReportNode Report
Report node.
Contains information about a language.
Task< string > GetStringAsync(Type Type, int Id, string Default)
Gets the string value of a string ID. If no such string exists, a string is created with the default ...
Query command that returns statistics of events logged to the event log.
override ICommand Copy()
Creates a copy of the command object.
EventStatisticsCommand(EventStatisticsNode ReportNode)
Query command that returns statistics of events logged to the event log.
override Task StartQueryExecutionAsync(Query Query, Language Language)
Starts the execution of a query.
override Task< string > GetNameAsync(Language Language)
Gets the displayable name of the command.
Query command that searches the event log for events.
Abstract base class for commands executing a server administrator report.
Defines a column in a table.
Class handling the reception of data from a query.
Task TableDone(string TableId)
Reports a table as being complete.
Task EndSection()
Ends a section. Each call to BeginSection(string) must be followed by a call to EndSection().
Task NewObject(object Object)
Reports a new object.
Task Start()
Starts query execution.
Task NewRecords(string TableId, params Record[] Records)
Reports a new set of records in a table.
Task BeginSection(string Header)
Begins a new section. Sections can be nested. Each call to BeginSection(string) must be followed by a...
Task NewTable(string TableId, string TableName, params Column[] Columns)
Defines a new table in the query output.
Task LogMessage(Exception Exception)
Logs an Exception as a query message.
async Task Done()
Query execution completed.
Task SetStatus(string Status)
Sets the current status of the query execution.
Task SetTitle(string Title)
Sets the title of the report.
Defines a record in a table.
class Header(ISimulationNode Parent, Model Model)
Represents an identity property.
ColumnAlignment
Column alignment.