-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from Falco20019/Falco20019/pr15+22
Falco20019/pr15+22
- Loading branch information
Showing
15 changed files
with
184 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
src/Serilog.Sinks.Loki.ExampleWebApp/Models/ErrorViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
using System; | ||
|
||
namespace Serilog.Sinks.Loki.ExampleWebApp.Models | ||
{ | ||
public class ErrorViewModel | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
using Serilog.Core; | ||
|
||
namespace Serilog.Sinks.Loki | ||
{ | ||
/* public static class ContextualLabels | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,33 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Serilog.Sinks.Loki.Labels | ||
{ | ||
class DefaultLogLabelProvider : ILogLabelProvider | ||
{ | ||
public IList<LokiLabel> GetLabels() | ||
public DefaultLogLabelProvider() : this(null) | ||
{ | ||
} | ||
|
||
public DefaultLogLabelProvider(IEnumerable<LokiLabel> labels, | ||
IEnumerable<string> propertiesAsLabels = null, | ||
IEnumerable<string> propertiesToAppend = null, | ||
LokiFormatterStrategy formatterStrategy = LokiFormatterStrategy.SpecificPropertiesAsLabelsAndRestAppended) | ||
{ | ||
return new List<LokiLabel>(); | ||
this.Labels = labels?.ToList() ?? new List<LokiLabel>(); | ||
this.PropertiesAsLabels = propertiesAsLabels?.ToList() ?? new List<string>(); | ||
this.PropertiesToAppend = propertiesToAppend?.ToList() ?? new List<string>(); | ||
this.FormatterStrategy = formatterStrategy; | ||
} | ||
|
||
public IList<string> PropertiesAsLabels { get; set; } = new List<string>(); | ||
public IList<LokiLabel> GetLabels() | ||
{ | ||
return this.Labels; | ||
} | ||
|
||
private IList<LokiLabel> Labels { get; } | ||
public IList<string> PropertiesAsLabels { get; } | ||
public IList<string> PropertiesToAppend { get; } | ||
public LokiFormatterStrategy FormatterStrategy { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace Serilog.Sinks.Loki { | ||
public enum LokiFormatterStrategy { | ||
/// All Serilog Event properties will be sent as labels | ||
AllPropertiesAsLabels, | ||
|
||
/// Specific Serilog Event properties will be sent as labels. | ||
/// The rest of properties will be discarder. | ||
SpecificPropertiesAsLabelsAndRestDiscarded, | ||
|
||
/// Specific Serilog Event properties will be sent as labels. | ||
/// The rest of properties will be appended to the log message. | ||
SpecificPropertiesAsLabelsAndRestAppended, | ||
|
||
/// Specific Serilog Event properties will be sent as labels. | ||
/// Other specific properties will be appended to the log message. | ||
/// The rest of properties will be discarded | ||
SpecificPropertiesAsLabelsOrAppended | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System.Collections.Generic; | ||
using Serilog.Sinks.Http; | ||
using Serilog.Sinks.Loki.Labels; | ||
|
||
namespace Serilog.Sinks.Loki | ||
{ | ||
public class LokiSinkConfiguration | ||
{ | ||
public string LokiUrl { get; set; } | ||
public string LokiUsername { get; set; } | ||
public string LokiPassword { get; set; } | ||
public ILogLabelProvider LogLabelProvider { get; set; } | ||
public IHttpClient HttpClient { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
test/Serilog.Sinks.Loki.Tests/Fixtures/HttpClientTestFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
using System; | ||
using JustEat.HttpClientInterception; | ||
using Xunit; | ||
|
||
namespace Serilog.Sinks.Loki.Tests | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters