Updated
This commit is contained in:
@@ -23,7 +23,6 @@ public class LoggerSettings
|
||||
private FileLoggerOptions _fileLoggerOptions;
|
||||
|
||||
private string _headerFormat = "{ts} {host} {category} {thread} {sev}";
|
||||
private int _maxMessageLength = 1024;
|
||||
private string _timestampFormat = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
/// <summary>
|
||||
@@ -126,9 +125,22 @@ public class LoggerSettings
|
||||
}
|
||||
}
|
||||
|
||||
public ELogType MaxLogType { get; set; } = ELogType.INFO;
|
||||
private List<ELogType> _logTypes = new List<ELogType> { ELogType.INFO, ELogType.WARNING, ELogType.ERROR, ELogType.TRAFFIC, ELogType.DEBUG, ELogType.CRITICAL, ELogType.TRACE };
|
||||
public List<ELogType> TypesToLog
|
||||
{
|
||||
get
|
||||
{
|
||||
return _logTypes;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_logTypes = value;
|
||||
}
|
||||
}
|
||||
|
||||
public List<Servers.Syslog.Syslog> SysLogServers { get; internal set; }
|
||||
public List<Logger.Servers.Splunk.Splunk> SplunkServers { get; internal set; }
|
||||
public List<Servers.Splunk.Splunk> SplunkServers { get; internal set; }
|
||||
|
||||
public List<Graylog> GrayLogServers { get; internal set; }
|
||||
public List<Servers.Tcp.Tcp> TcpServers { get; internal set; }
|
||||
@@ -232,4 +244,100 @@ public class LoggerSettings
|
||||
{
|
||||
OnLog = null;
|
||||
}
|
||||
|
||||
public void AllowAllLogTypes()
|
||||
{
|
||||
TypesToLog.Clear();
|
||||
}
|
||||
|
||||
public void LogInfo()
|
||||
{
|
||||
if (TypesToLog == null)
|
||||
{
|
||||
TypesToLog = new List<ELogType>();
|
||||
}
|
||||
|
||||
if (!TypesToLog.Contains(ELogType.INFO))
|
||||
{
|
||||
TypesToLog.Add(ELogType.INFO);
|
||||
}
|
||||
}
|
||||
|
||||
public void LogWarning()
|
||||
{
|
||||
if (TypesToLog == null)
|
||||
{
|
||||
TypesToLog = new List<ELogType>();
|
||||
}
|
||||
|
||||
if (!TypesToLog.Contains(ELogType.WARNING))
|
||||
{
|
||||
TypesToLog.Add(ELogType.WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
public void LogError()
|
||||
{
|
||||
if (TypesToLog == null)
|
||||
{
|
||||
TypesToLog = new List<ELogType>();
|
||||
}
|
||||
|
||||
if (!TypesToLog.Contains(ELogType.ERROR))
|
||||
{
|
||||
TypesToLog.Add(ELogType.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
public void LogCritical()
|
||||
{
|
||||
if (TypesToLog == null)
|
||||
{
|
||||
TypesToLog = new List<ELogType>();
|
||||
}
|
||||
|
||||
if (!TypesToLog.Contains(ELogType.CRITICAL))
|
||||
{
|
||||
TypesToLog.Add(ELogType.CRITICAL);
|
||||
}
|
||||
}
|
||||
|
||||
public void LogTraffic()
|
||||
{
|
||||
if (TypesToLog == null)
|
||||
{
|
||||
TypesToLog = new List<ELogType>();
|
||||
}
|
||||
|
||||
if (!TypesToLog.Contains(ELogType.TRAFFIC))
|
||||
{
|
||||
TypesToLog.Add(ELogType.TRAFFIC);
|
||||
}
|
||||
}
|
||||
|
||||
public void LogTrace()
|
||||
{
|
||||
if (TypesToLog == null)
|
||||
{
|
||||
TypesToLog = new List<ELogType>();
|
||||
}
|
||||
|
||||
if (!TypesToLog.Contains(ELogType.TRACE))
|
||||
{
|
||||
TypesToLog.Add(ELogType.TRACE);
|
||||
}
|
||||
}
|
||||
|
||||
public void LogDebug()
|
||||
{
|
||||
if (TypesToLog == null)
|
||||
{
|
||||
TypesToLog = new List<ELogType>();
|
||||
}
|
||||
|
||||
if (!TypesToLog.Contains(ELogType.DEBUG))
|
||||
{
|
||||
TypesToLog.Add(ELogType.DEBUG);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user