-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathLogData.cs
78 lines (60 loc) · 2.4 KB
/
LogData.cs
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright 2020 New Relic, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
using System;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace NewRelic.Agent.IntegrationTestHelpers.Models
{
public class LogEventData
{
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
{
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
DateParseHandling = DateParseHandling.None,
Converters =
{
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
},
};
public static LogEventData[] FromJson(string json) => JsonConvert.DeserializeObject<LogEventData[]>(json, Settings);
[JsonProperty("common")]
public LogEventDataCommon Common { get; set; }
[JsonProperty("logs")]
public LogLine[] Logs { get; set; }
}
public partial class LogEventDataCommon
{
[JsonProperty("attributes")]
public LogEventDataCommonAttributes Attributes { get; set; }
}
public class LogEventDataCommonAttributes
{
[JsonProperty("entity.name")]
public string EntityName { get; set; }
[JsonProperty("entity.guid")]
public string EntityGuid { get; set; }
[JsonProperty("hostname")]
public string Hostname { get; set; }
}
public class LogLine
{
[JsonProperty("timestamp")]
public long Timestamp { get; set; }
[JsonProperty("message", NullValueHandling = NullValueHandling.Ignore)]
public string Message { get; set; }
[JsonProperty("level")]
public string Level { get; set; }
[JsonProperty("span.id", NullValueHandling = NullValueHandling.Ignore)]
public string Spanid { get; set; }
[JsonProperty("trace.id", NullValueHandling = NullValueHandling.Ignore)]
public string Traceid { get; set; }
[JsonProperty("error.stack", NullValueHandling = NullValueHandling.Ignore)]
public string ErrorStack { get; set; }
[JsonProperty("error.message", NullValueHandling = NullValueHandling.Ignore)]
public string ErrorMessage { get; set; }
[JsonProperty("error.class", NullValueHandling = NullValueHandling.Ignore)]
public string ErrorClass { get; set; }
}
}