private static string ToJson(IEnumerable<LogEvent> events) { var data = new RawEvents { Events = events.Select(e => RawEvent.FromLogEvent(e)).ToArray() }; string json = data.ToJsonString(); return json; }
private static string ToJson(IEnumerable <LogEvent> events) { var data = new RawEvents { Events = events.Select(e => RawEvent.FromLogEvent(e)).ToArray() }; throw new NotImplementedException(); //string json = data.ToJsonString(); //return json; }
private static string ToJson(IEnumerable <LogEvent> events) { var data = new RawEvents { Events = events.Select(e => RawEvent.FromLogEvent(e)).ToArray() }; string json = data.ToJsonString(); return(json); }
private void AddEvent(IRecorderEvent e) { if (_windowTracker.HasActiveWindowChanged()) { LogWindowInfo(); OnLogAction(string.Format("Active Window Changed to: {0} id: {0}", _windowTracker.GetActiveWindowTitle(), _windowTracker.GetActiveWindowId().ToInt64())); RawEvents.Add(new TransitionEvent() { TransitionType = TransitionType.ActiveWindowChanged }); } RawEvents.Add(e); }
public async Task PublishAsync(HealthReport report, CancellationToken cancellationToken) { var level = _options.DefaultInputLevel; switch (report.Status) { case HealthStatus.Degraded: level = SeqInputLevel.Warning; break; case HealthStatus.Unhealthy: level = SeqInputLevel.Error; break; } var events = new RawEvents { Events = new[] { new RawEvent { Timestamp = DateTimeOffset.UtcNow, MessageTemplate = $"[{Assembly.GetEntryAssembly()?.GetName().Name} - HealthCheck Result]", Level = level.ToString(), Properties = new Dictionary <string, object> { { nameof(Environment.MachineName), Environment.MachineName }, { nameof(Assembly), Assembly.GetEntryAssembly()?.GetName().Name }, { "Status", report.Status.ToString() }, { "TimeElapsed", report.TotalDuration.TotalMilliseconds }, { "RawReport", JsonConvert.SerializeObject(report) } } } } }; await PushMetrics(JsonConvert.SerializeObject(events)); }
public async Task PublishAsync(HealthReport report, CancellationToken cancellationToken) { var level = "Information"; switch (report.Status) { case HealthStatus.Degraded: level = "Warning"; break; case HealthStatus.Unhealthy: level = "Error"; break; } var events = new RawEvents { Events = new RawEvent[] { new RawEvent { Timestamp = DateTimeOffset.UtcNow, MessageTemplate = EVENT_NAME, Level = level, Properties = new Dictionary <string, object> { { nameof(Environment.MachineName), Environment.MachineName }, { nameof(Assembly), Assembly.GetEntryAssembly().GetName().Name }, { METRIC_STATUS_NAME, (int)report.Status }, { METRIC_DURATION_NAME, report.TotalDuration.TotalMilliseconds } } } } }; await PushMetrics(JsonConvert.SerializeObject(events)); }