-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathLogLabelProvider.cs
More file actions
28 lines (26 loc) · 894 Bytes
/
LogLabelProvider.cs
File metadata and controls
28 lines (26 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System.Collections.Generic;
using Serilog.Sinks.Loki.Labels;
namespace Serilog.Sinks.Loki.Example
{
public class LogLabelProvider : ILogLabelProvider
{
public IList<LokiLabel> GetLabels()
{
return new List<LokiLabel>
{
new LokiLabel("app", "demo"),
new LokiLabel("namespace", "prod")
};
}
public IList<string> PropertiesAsLabels { get; set; } = new List<string>
{
"level", // Since 3.0.0, you need to explicitly add level if you want it!
"MyLabelPropertyName"
};
public IList<string> PropertiesToAppend { get; set; } = new List<string>
{
"MyAppendPropertyName"
};
public LokiFormatterStrategy FormatterStrategy { get; set; } = LokiFormatterStrategy.SpecificPropertiesAsLabelsOrAppended;
}
}