-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathEvents.cs
More file actions
51 lines (43 loc) · 1015 Bytes
/
Events.cs
File metadata and controls
51 lines (43 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Waher.Events;
namespace ActuatorHttp
{
public class Events : EventSink
{
public Events() : base(string.Empty)
{
}
public override Task Queue(Event Event)
{
StringBuilder sb = new StringBuilder(Event.Message);
if (!string.IsNullOrEmpty(Event.Object))
{
sb.Append(' ');
sb.Append(Event.Object);
}
if (!string.IsNullOrEmpty(Event.Actor))
{
sb.Append(' ');
sb.Append(Event.Actor);
}
foreach (KeyValuePair<string,object> Parameter in Event.Tags)
{
sb.Append(" [");
sb.Append(Parameter.Key);
sb.Append("=");
if (Parameter.Value != null)
sb.Append(Parameter.Value.ToString());
sb.Append("]");
}
if (Event.Type >= EventType.Critical && !string.IsNullOrEmpty(Event.StackTrace))
{
sb.Append("\r\n\r\n");
sb.Append(Event.StackTrace);
}
MainPage.Instance.AddLogMessage(sb.ToString());
return Task.CompletedTask;
}
}
}