-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathLoggerOptions.cs
More file actions
36 lines (26 loc) · 1.29 KB
/
LoggerOptions.cs
File metadata and controls
36 lines (26 loc) · 1.29 KB
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
using System;
namespace Gsemac.IO.Logging {
public class LoggerOptions :
ILoggerOptions {
public bool Enabled { get; set; } = true;
public string DirectoryPath { get; set; } = string.Empty;
public ILogHeaderCollection Headers { get; set; } = new LogHeaderCollection();
public bool IgnoreExceptions { get; set; } = true;
public ILogMessageFormatter MessageFormatter { get; set; } = new LogMessageFormatter();
public ILogFileNameFormatter FileNameFormatter { get; set; } = new UnixTimestampLogFileNameFormatter();
public ILogRetentionPolicy RetentionPolicy { get; set; } = new PreserveLogRetentionPolicy();
public static LoggerOptions Default => new LoggerOptions();
public LoggerOptions() { }
public LoggerOptions(ILoggerOptions options) {
if (options is null)
throw new ArgumentNullException(nameof(options));
Enabled = options.Enabled;
DirectoryPath = options.DirectoryPath;
Headers = options.Headers;
IgnoreExceptions = options.IgnoreExceptions;
MessageFormatter = options.MessageFormatter;
FileNameFormatter = options.FileNameFormatter;
RetentionPolicy = options.RetentionPolicy;
}
}
}