Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@

public static class RemoteInstanceConverter
{
public static List<RemoteInstanceSetting> FromJson(string json) => JsonSerializer.Deserialize<List<RemoteInstanceSetting>>(json, Options);
public static List<RemoteInstanceSetting> FromJson(string json) => JsonSerializer.Deserialize(json, RemoteInstanceContext.Default.ListRemoteInstanceSetting);

public static string ToJson(IList<RemoteInstanceSetting> settings) => JsonSerializer.Serialize(settings, Options);

static readonly JsonSerializerOptions Options = new()
{
WriteIndented = false,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
};
public static string ToJson(List<RemoteInstanceSetting> settings) => JsonSerializer.Serialize(settings, RemoteInstanceContext.Default.ListRemoteInstanceSetting);
}

[JsonSourceGenerationOptions(WriteIndented = false, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
[JsonSerializable(typeof(List<RemoteInstanceSetting>))]
public partial class RemoteInstanceContext : JsonSerializerContext;

public class RemoteInstanceSetting
{
[JsonPropertyName("api_uri")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public async Task<bool> Add(ServiceControlAuditNewInstance details, Func<PathInf
}
catch (Exception ex)
{
logger.Error(ex.Message);
logger.Error("Error installing the service: {0}", ex);
return false;
}

Expand Down Expand Up @@ -137,7 +137,7 @@ public bool Upgrade(ServiceControlAuditInstance instance, bool force)
}
catch (Exception ex)
{
logger.Error("Upgrade Failed: {0}", ex.Message);
logger.Error("Upgrade Failed: {0}", ex);
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public async Task<bool> Add(MonitoringNewInstance details, Func<PathInfo, Task<b
}
catch (Exception ex)
{
logger.Error(ex.Message);
logger.Error("Error installing the service: {0}", ex);
return false;
}

Expand Down Expand Up @@ -130,7 +130,7 @@ public bool Upgrade(MonitoringInstance instance)
}
catch (Exception ex)
{
logger.Error("Upgrade Failed: {0}", ex.Message);
logger.Error("Upgrade Failed: {0}", ex);
return false;
}

Expand Down Expand Up @@ -178,7 +178,7 @@ internal async Task<bool> Update(MonitoringInstance instance, bool startService)
}
catch (Exception ex)
{
logger.Error("Update failed: {0}", ex.Message);
logger.Error("Update failed: {0}", ex);
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public async Task<bool> Add(ServiceControlNewInstance details, Func<PathInfo, Ta
}
catch (Exception ex)
{
logger.Error(ex.Message);
logger.Error("Error installing the service: {0}", ex);
return false;
}

Expand Down Expand Up @@ -131,7 +131,7 @@ public bool Upgrade(ServiceControlInstance instance, ServiceControlUpgradeOption
}
catch (Exception ex)
{
logger.Error("Upgrade Failed: {0}", ex.Message);
logger.Error("Upgrade Failed: {0}", ex);
return false;
}
finally
Expand Down Expand Up @@ -175,7 +175,7 @@ internal async Task<bool> Update(ServiceControlInstance instance, bool startServ
}
catch (Exception ex)
{
logger.Error("Update failed: {0}", ex.Message);
logger.Error("Update failed: {0}", ex);
return false;
}
finally
Expand Down Expand Up @@ -270,7 +270,7 @@ public bool AddRemoteInstance(ServiceControlInstance instance, string[] remoteIn
}
catch (Exception ex)
{
logger.Error("Adding remote instances Failed: {0}", ex.Message);
logger.Error("Adding remote instances Failed: {0}", ex);
return false;
}
finally
Expand Down Expand Up @@ -310,7 +310,7 @@ public bool RemoveRemoteInstance(ServiceControlInstance instance, string[] remot
}
catch (Exception ex)
{
logger.Error("Removing remote instances Failed: {0}", ex.Message);
logger.Error("Removing remote instances Failed: {0}", ex);
return false;
}
finally
Expand Down