Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
LoggerTelemetry.cs
1using System;
5
7{
12 {
13 public void OnEvent(ObservableTaskEvent e)
14 {
15 try
16 {
17 string Msg =
18 $"[TaskTelemetry] Name={e.Name}, " +
19 $"Status={e.Status}, " +
20 $"Elapsed={e.Elapsed.TotalMilliseconds:F0}ms, " +
21 $"IsRefresh={e.IsRefresh}";
22
23 if (e.Exception is not null)
24 {
25 Msg += $", Exception={e.Exception.GetType().Name}: {e.Exception.Message}";
26 }
27
28 ServiceRef.LogService.LogInformational(Msg);
29 }
30 catch (Exception Ex)
31 {
32 // Never let telemetry exceptions break the app.
33 ServiceRef.LogService.LogException(Ex);
34 }
35 }
36 }
37}
Base class that references services in the app.
Definition: ServiceRef.cs:43
static ILogService LogService
Log service.
Definition: ServiceRef.cs:214
Basic telemetry that writes ObservableTask events to the app log.