-
Notifications
You must be signed in to change notification settings - Fork 42
/
GelfLoggerOptions.cs
79 lines (65 loc) · 2.62 KB
/
GelfLoggerOptions.cs
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
namespace Gelf.Extensions.Logging
{
public class GelfLoggerOptions
{
/// <summary>
/// Enable/disable additional fields added via log scopes.
/// </summary>
public bool IncludeScopes { get; set; } = true;
/// <summary>
/// Protocol used to send logs.
/// </summary>
public GelfProtocol Protocol { get; set; } = GelfProtocol.Udp;
/// <summary>
/// GELF server host.
/// </summary>
public string? Host { get; set; }
/// <summary>
/// GELF server port.
/// </summary>
public int Port { get; set; } = 12201;
/// <summary>
/// Log source name mapped to the GELF host field (required).
/// </summary>
public string? LogSource { get; set; }
/// <summary>
/// Enable GZip message compression for UDP logging.
/// </summary>
public bool CompressUdp { get; set; } = true;
/// <summary>
/// The UDP message size in bytes under which messages will not be compressed.
/// </summary>
public int UdpCompressionThreshold { get; set; } = 512;
/// <summary>
/// The UDP message max size in bytes to be sent in one datagram.
/// </summary>
public int UdpMaxChunkSize { get; set; } = 8192;
/// <summary>
/// Additional fields that will be attached to all log messages.
/// </summary>
public Dictionary<string, object?> AdditionalFields { get; set; } = new();
/// <summary>
/// Additional fields computed based on raw log data.
/// </summary>
public Func<GelfLogContext, IEnumerable<KeyValuePair<string, object?>>>? AdditionalFieldsFactory { get; set; }
/// <summary>
/// Headers used when sending logs via HTTP(S).
/// </summary>
public Dictionary<string, string> HttpHeaders { get; set; } = new();
/// <summary>
/// Timeout used when sending logs via HTTP(S).
/// </summary>
public TimeSpan HttpTimeout { get; set; } = TimeSpan.FromSeconds(30);
/// <summary>
/// Include a field with the original message template before structured log parameters are replaced.
/// </summary>
public bool IncludeMessageTemplates { get; set; }
/// <summary>
/// Include default fields (logger, exception, event_id, event_name).
/// </summary>
public bool IncludeDefaultFields { get; set; } = true;
}
}