47 lines
1.9 KiB
C#
47 lines
1.9 KiB
C#
using Microsoft.Extensions.Logging;
|
|
|
|
namespace xLoggingService.Configuration
|
|
{
|
|
public sealed class XLoggingServiceConfiguration
|
|
{
|
|
public bool Enabled { get; set; } = false;
|
|
public XFileLogConfiguration File { get; set; } = new();
|
|
public XLogQueueConfiguration Queue { get; set; } = new();
|
|
public XEventLogConfiguration Event { get; set; } = new();
|
|
public XDatabaseLogConfiguration Database { get; set; } = new();
|
|
public LogLevel MinimumLevel { get; set; } = LogLevel.Information;
|
|
}
|
|
|
|
public class XLogQueueConfiguration {
|
|
public bool Enabled { get; set; }
|
|
public int Capacity { get; set; } = 10000;
|
|
public int ShutdownTimeoutSeconds { get; set; } = 10;
|
|
}
|
|
|
|
public class XFileLogConfiguration {
|
|
public bool Enabled { get; set; }
|
|
public string Format { get; set; } = "Json";
|
|
public string Directory { get; set; } = "./Logs";
|
|
public int RetainedFileCountLimit { get; set; } = 30;
|
|
public string FileName { get; set; } = "x-logging-.log";
|
|
public LogLevel MinimumLevel { get; set; } = LogLevel.Information;
|
|
}
|
|
|
|
public class XDatabaseLogConfiguration {
|
|
public bool Enabled { get; set; } = false;
|
|
public string ConnectionString { get; set; }
|
|
public string TableName { get; set; } = "XLogs";
|
|
public bool AutoCreateTable { get; set; } = true;
|
|
public LogLevel MinimumLevel { get; set; } = LogLevel.Warning;
|
|
public string Provider { get; set; } = "Microsoft.Data.Sqlite";
|
|
}
|
|
|
|
public class XEventLogConfiguration {
|
|
public bool Enabled { get; set; } = false;
|
|
public string Sender { get; set; } = "Application";
|
|
public string Action { get; set; } = "XLogCreated";
|
|
public LogLevel MinimumLevel { get; set; } = LogLevel.Error;
|
|
public string Topic { get; set; } = "x-logging-service-logs";
|
|
}
|
|
}
|