Skip to content

Commit 90254cf

Browse files
authored
Merge pull request #55 from datalust/dev
2.1.0 Release
2 parents a7d1e55 + 257ed46 commit 90254cf

File tree

4 files changed

+26
-10
lines changed

4 files changed

+26
-10
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ artifacts:
1212
deploy:
1313
- provider: NuGet
1414
api_key:
15-
secure: Hl9pr1a2/2Y9u9XwPO8FUCpGbO8taYFhYVnDRJbvl3rs5fcFaqd91+QbrcrtES/x
15+
secure: 71c2lLlQfEUp7lWA9Zo+BneSkHO5xuZVeIt+bqmqlzHg4g3NgVf0Buwp4pAhoGO5
1616
skip_symbols: true
1717
on:
1818
branch: /^(main|dev)$/

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sdk": {
3-
"version": "5.0.102"
3+
"version": "5.0.401"
44
}
55
}

src/NLog.Targets.Seq/NLog.Targets.Seq.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<Description>An NLog target that writes structured log events to Seq</Description>
55
<Authors>Datalust;Contributors</Authors>
6-
<VersionPrefix>2.0.0</VersionPrefix>
6+
<VersionPrefix>2.1.0</VersionPrefix>
77
<TargetFrameworks>net4.5;net4.6.2;netstandard2.0;net5.0</TargetFrameworks>
88
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
99
<GenerateDocumentationFile>true</GenerateDocumentationFile>

src/NLog.Targets.Seq/SeqTarget.cs

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,16 @@ public sealed class SeqTarget : Target
6868
/// A Seq <i>API key</i> that authenticates the client to the Seq server.
6969
/// </summary>
7070
public string ApiKey { get => (_apiKey as SimpleLayout)?.Text; set => _apiKey = value ?? string.Empty; }
71-
71+
7272
/// <summary>
7373
/// The address of the proxy to use, including port separated by a colon. If not provided, default operating system proxy will be used.
7474
/// </summary>
75+
7576
public string ProxyAddress { get => (_proxyAddress as SimpleLayout)?.Text; set => _proxyAddress = value ?? string.Empty; }
77+
/// <summary>
78+
/// Use default credentials
79+
/// </summary>
80+
public bool UseDefaultCredentials { get; set; }
7681

7782
/// <summary>
7883
/// A list of properties that will be attached to the events.
@@ -91,7 +96,7 @@ public int MaxRecursionLimit
9196
get => TemplatedClefLayout.MaxRecursionLimit;
9297
set { TemplatedClefLayout.MaxRecursionLimit = value; TextClefLayout.MaxRecursionLimit = value; }
9398
}
94-
99+
95100
/// <summary>
96101
/// Construct a <see cref="SeqTarget"/>.
97102
/// </summary>
@@ -102,7 +107,7 @@ public SeqTarget()
102107
OptimizeBufferReuse = true;
103108
JsonPayloadMaxLength = 128 * 1024;
104109
}
105-
110+
106111
/// <summary>
107112
/// Initializes the target. Can be used by inheriting classes
108113
/// to initialize logging.
@@ -130,8 +135,19 @@ protected override void InitializeTarget()
130135

131136
var proxyAddress = _proxyAddress?.Render(LogEventInfo.CreateNullEvent()) ?? string.Empty;
132137
if (!string.IsNullOrEmpty(proxyAddress))
133-
handler = new HttpClientHandler {Proxy = new WebProxy(new Uri(proxyAddress), true)};
134-
138+
handler = new HttpClientHandler { Proxy = new WebProxy(new Uri(proxyAddress), true) };
139+
if (UseDefaultCredentials)
140+
{
141+
if (handler != null)
142+
{
143+
handler.UseDefaultCredentials = UseDefaultCredentials;
144+
}
145+
else
146+
{
147+
handler = new HttpClientHandler { UseDefaultCredentials = UseDefaultCredentials };
148+
}
149+
}
150+
135151
_httpClient = handler == null ? new HttpClient() : new HttpClient(handler);
136152
}
137153

@@ -187,7 +203,7 @@ async Task PostBatch(IList<AsyncLogEventInfo> logEvents)
187203
var request = new HttpRequestMessage(HttpMethod.Post, _webRequestUri);
188204
if (!string.IsNullOrWhiteSpace(_headerApiKey))
189205
request.Headers.Add(SeqApi.ApiKeyHeaderName, _headerApiKey);
190-
206+
191207
List<AsyncLogEventInfo> extraBatch = null;
192208
var totalPayload = 0;
193209
var payload = new StringBuilder();
@@ -222,7 +238,7 @@ async Task PostBatch(IList<AsyncLogEventInfo> logEvents)
222238
}
223239

224240
request.Content = new StringContent(payload.ToString(), Utf8, SeqApi.CompactLogEventFormatMediaType);
225-
241+
226242
// Even if no events are above `_minimumLevel`, we'll send a batch to make sure we observe minimum
227243
// level changes sent by the server.
228244

0 commit comments

Comments
 (0)