Skip to content

Commit

Permalink
Make the class LokiHttpClient abstract to be used in appsettings.json
Browse files Browse the repository at this point in the history
  • Loading branch information
Anas El Hajjaji committed Nov 4, 2020
1 parent 88860a5 commit 2b780a8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/Serilog.Sinks.Loki/DefaultLokiHttpClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Serilog.Sinks.Loki
{
public class DefaultLokiHttpClient : LokiHttpClient
{
}
}
2 changes: 1 addition & 1 deletion src/Serilog.Sinks.Loki/LokiHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Serilog.Sinks.Loki
{
public class LokiHttpClient : IHttpClient
public abstract class LokiHttpClient : IHttpClient
{
protected readonly HttpClient HttpClient;

Expand Down
2 changes: 1 addition & 1 deletion src/Serilog.Sinks.Loki/LokiSinkExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ private static LoggerConfiguration LokiHttpImpl(this LoggerSinkConfiguration sin
{
var formatter = logLabelProvider != null ? new LokiBatchFormatter(logLabelProvider.GetLabels()) : new LokiBatchFormatter();

var client = httpClient ?? new LokiHttpClient();
var client = httpClient ?? new DefaultLokiHttpClient();
if (client is LokiHttpClient c)
{
c.SetAuthCredentials(credentials);
Expand Down

0 comments on commit 2b780a8

Please sign in to comment.