Added braces

This commit is contained in:
2025-04-27 08:07:47 +02:00
parent b50ab3784c
commit d981397b02
13 changed files with 63 additions and 23 deletions

View File

@@ -47,7 +47,9 @@ public class Graylog : IDisposable
set
{
if (string.IsNullOrEmpty(value))
{
throw new ArgumentNullException(nameof(Hostname));
}
_Hostname = value;
SetUdp();
@@ -60,7 +62,9 @@ public class Graylog : IDisposable
set
{
if (value < 0)
{
throw new ArgumentException("Port must be zero or greater.");
}
_Port = value;
SetUdp();

View File

@@ -95,7 +95,10 @@ public class Splunk : IDisposable
public async Task<HttpResponseMessage> SendAsync(SplunkPayload splunkPayload, bool disableSplunkSSL = false)
{
if (splunkPayload == null) return null;
if (splunkPayload == null)
{
return null;
}
var eventObject = new
{
@@ -115,7 +118,10 @@ public class Splunk : IDisposable
}
var eventJson = JsonHelper.ToJson(eventObject);
if (!HasHecToken) CreateHttpClient();
if (!HasHecToken)
{
CreateHttpClient();
}
using var content = new StringContent(eventJson, Encoding.UTF8, "application/json");
return await HttpClient.PostAsync("/services/collector/event", content);

View File

@@ -47,9 +47,11 @@ public class Syslog : IDisposable
get => _Hostname;
set
{
if (string.IsNullOrEmpty(value))
throw new ArgumentNullException(nameof(Hostname));
if (string.IsNullOrEmpty(value))
{
throw new ArgumentNullException(nameof(Hostname));
}
_Hostname = value;
SetUdp();
}
@@ -60,9 +62,11 @@ public class Syslog : IDisposable
get => _Port;
set
{
if (value < 0)
throw new ArgumentException("Port must be zero or greater.");
if (value < 0)
{
throw new ArgumentException("Port must be zero or greater.");
}
_Port = value;
SetUdp();
}

View File

@@ -43,7 +43,9 @@ namespace EonaCat.Logger.Servers.Tcp
set
{
if (string.IsNullOrEmpty(value))
{
throw new ArgumentNullException(nameof(Hostname));
}
_Hostname = value;
SetTcp();
@@ -56,7 +58,9 @@ namespace EonaCat.Logger.Servers.Tcp
set
{
if (value < 0)
{
throw new ArgumentException("Port must be zero or greater.");
}
_Port = value;
SetTcp();

View File

@@ -42,7 +42,9 @@ namespace EonaCat.Logger.Servers.Udp
set
{
if (string.IsNullOrEmpty(value))
{
throw new ArgumentNullException(nameof(Hostname));
}
_Hostname = value;
SetUdp();
@@ -55,7 +57,9 @@ namespace EonaCat.Logger.Servers.Udp
set
{
if (value < 0)
{
throw new ArgumentException("Port must be zero or greater.");
}
_Port = value;
SetUdp();