Skip to content

Commit 5b58d36

Browse files
author
sam.gerene
committed
[Add] logging statements to API deserializers
[Add] improve code as per SQ suggestions
1 parent 5f6e3a8 commit 5b58d36

File tree

7 files changed

+26
-2
lines changed

7 files changed

+26
-2
lines changed

SysML2.NET.Serializer.Json/API/BranchDeserializer.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ internal static Branch DeSerialize(JsonElement jsonElement, SerializationModeKin
6363
throw new InvalidOperationException($"The BranchDeserializer can only be used to deserialize objects of type Branch, a {@type.GetString()} was provided");
6464
}
6565

66+
logger.Log(LogLevel.Trace, "start deserialization: Branch");
67+
6668
var dtoInstance = new SysML2.NET.API.DTO.Branch();
6769

6870
if (jsonElement.TryGetProperty("@id", out JsonElement idProperty))
@@ -184,6 +186,8 @@ internal static Branch DeSerialize(JsonElement jsonElement, SerializationModeKin
184186
logger.LogDebug($"the timestamp Json property was not found in the Branch: {dtoInstance.Id}");
185187
}
186188

189+
logger.Log(LogLevel.Trace, "finish deserialization: Branch");
190+
187191
return dtoInstance;
188192
}
189193
}

SysML2.NET.Serializer.Json/API/CommitDeSerializer.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ internal static Commit DeSerialize(JsonElement jsonElement, SerializationModeKin
6363
throw new InvalidOperationException($"The CommitDeSerializer can only be used to deserialize objects of type Commit, a {@type.GetString()} was provided");
6464
}
6565

66+
logger.Log(LogLevel.Trace, "start deserialization: Commit");
67+
6668
var dtoInstance = new SysML2.NET.API.DTO.Commit();
6769

6870
if (jsonElement.TryGetProperty("@id", out JsonElement idProperty))
@@ -157,6 +159,8 @@ internal static Commit DeSerialize(JsonElement jsonElement, SerializationModeKin
157159
logger.LogDebug($"the timestamp Json property was not found in the Commit: {dtoInstance.Id}");
158160
}
159161

162+
logger.Log(LogLevel.Trace, "finish deserialization: Commit");
163+
160164
return dtoInstance;
161165
}
162166
}

SysML2.NET.Serializer.Json/API/DataIdentityDeSerializer.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ internal static DataIdentity DeSerialize(JsonElement jsonElement, SerializationM
6363
throw new InvalidOperationException($"The DataIdentityDeSerializer only be used to deserialize objects of type DataIdentity, a {@type.GetString()} was provided");
6464
}
6565

66+
logger.Log(LogLevel.Trace, "start deserialization: DataIdentity");
67+
6668
var dtoInstance = new SysML2.NET.API.DTO.DataIdentity();
6769

6870
if (jsonElement.TryGetProperty("@id", out JsonElement idPropertyVersionItem))
@@ -76,6 +78,8 @@ internal static DataIdentity DeSerialize(JsonElement jsonElement, SerializationM
7678
dtoInstance.Id = Guid.Parse(idPropertyVersionItemValue);
7779
}
7880

81+
logger.Log(LogLevel.Trace, "finish deserialization: DataIdentity");
82+
7983
return dtoInstance;
8084
}
8185
}

SysML2.NET.Serializer.Json/API/DataVersionDeSerializer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ internal static class DataVersionDeSerializer
5252
internal static DataVersion DeSerialize(JsonElement jsonElement, SerializationModeKind serializationModeKind, ILoggerFactory loggerFactory = null)
5353
{
5454
var logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger("DataVersionDeSerializer");
55-
55+
56+
logger.Log(LogLevel.Trace, "start deserialization: DataVersion");
57+
5658
var dtoInstance = new SysML2.NET.API.DTO.DataVersion();
5759

5860
if (jsonElement.TryGetProperty("@id", out JsonElement idPropertyVersionItem))
@@ -90,6 +92,8 @@ internal static DataVersion DeSerialize(JsonElement jsonElement, SerializationMo
9092
logger.LogDebug($"the payload Json property was not found in the DataVersion: {dtoInstance.Id}");
9193
}
9294

95+
logger.Log(LogLevel.Trace, "finish deserialization: DataVersion");
96+
9397
return dtoInstance;
9498
}
9599
}

SysML2.NET.Serializer.Json/API/ProjectDeSerializer.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ internal static Project DeSerialize(JsonElement jsonElement, SerializationModeKi
6363
throw new InvalidOperationException($"The ProjectDeSerializer can only be used to deserialize objects of type Project, a {@type.GetString()} was provided");
6464
}
6565

66+
logger.Log(LogLevel.Trace, "start deserialization: Project");
67+
6668
var dtoInstance = new SysML2.NET.API.DTO.Project();
6769

6870
if (jsonElement.TryGetProperty("@id", out JsonElement idProperty))
@@ -143,6 +145,8 @@ internal static Project DeSerialize(JsonElement jsonElement, SerializationModeKi
143145
logger.LogDebug($"the name Json property was not found in the Project: {dtoInstance.Id}");
144146
}
145147

148+
logger.Log(LogLevel.Trace, "finish deserialization: Project");
149+
146150
return dtoInstance;
147151
}
148152
}

SysML2.NET.Serializer.Json/API/TagDeserializer.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ internal static Tag DeSerialize(JsonElement jsonElement, SerializationModeKind s
6363
throw new InvalidOperationException($"The TagDeserializer can only be used to deserialize objects of type Tag, a {@type.GetString()} was provided");
6464
}
6565

66+
logger.Log(LogLevel.Trace, "start deserialization: Tag");
67+
6668
var dtoInstance = new SysML2.NET.API.DTO.Tag();
6769

6870
if (jsonElement.TryGetProperty("@id", out JsonElement idProperty))
@@ -166,6 +168,8 @@ internal static Tag DeSerialize(JsonElement jsonElement, SerializationModeKind s
166168
logger.LogDebug($"the timestamp Json property was not found in the Tag: {dtoInstance.Id}");
167169
}
168170

171+
logger.Log(LogLevel.Trace, "finish deserialization: Tag");
172+
169173
return dtoInstance;
170174
}
171175
}

SysML2.NET.Viewer/ViewModels/Components/LoginViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class LoginViewModel : ReactiveObject, ILoginViewModel
4646
/// <summary>
4747
/// The (dependency) injected <see cref="IRestClient"/>
4848
/// </summary>
49-
private IRestClient restClient;
49+
private readonly IRestClient restClient;
5050

5151
/// <summary>
5252
/// Initializes a new instance of the <see cref="LoginViewModel"/>

0 commit comments

Comments
 (0)