removed other projects
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using System.Drawing;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Serilog.Sinks.LogView.Core.Logging;
|
||||
|
||||
namespace LogViewer.Core;
|
||||
|
||||
public class DataStoreLoggerConfiguration
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public EventId EventId { get; set; }
|
||||
|
||||
public Dictionary<LogLevel, LogEntryColor> Colors { get; } = new()
|
||||
{
|
||||
[LogLevel.Trace] = new() { Foreground = Color.DarkGray },
|
||||
[LogLevel.Debug] = new() { Foreground = Color.Gray },
|
||||
[LogLevel.Information] = new(),
|
||||
[LogLevel.Warning] = new() { Foreground = Color.Orange},
|
||||
[LogLevel.Error] = new() { Foreground = Color.White, Background = Color.OrangeRed },
|
||||
[LogLevel.Critical] = new() { Foreground=Color.White, Background = Color.Red },
|
||||
[LogLevel.None] = new(),
|
||||
};
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Serilog.Sinks.LogView.Core.Logging;
|
||||
|
||||
public interface ILogDataStore
|
||||
{
|
||||
ObservableCollection<LogModel> Entries { get; }
|
||||
void AddEntry(LogModel logModel);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Serilog.Sinks.LogView.Core.Logging;
|
||||
|
||||
public interface ILogDataStoreCore
|
||||
{
|
||||
public ILogDataStore DataStore { get; }
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Serilog.Sinks.LogView.Core.Logging;
|
||||
|
||||
public class LogDataStore : ILogDataStore
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private static readonly SemaphoreSlim _semaphore = new(initialCount: 1);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public ObservableCollection<LogModel> Entries { get; } = new();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public virtual void AddEntry(LogModel logModel)
|
||||
{
|
||||
// ensure only one operation at time from multiple threads
|
||||
_semaphore.Wait();
|
||||
|
||||
Entries.Add(logModel);
|
||||
|
||||
_semaphore.Release();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace Serilog.Sinks.LogView.Core.Logging;
|
||||
|
||||
public class LogEntryColor
|
||||
{
|
||||
public Color Foreground { get; set; } = Color.Black;
|
||||
public Color Background { get; set; } = Color.Transparent;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Serilog.Sinks.LogView.Core.Logging;
|
||||
|
||||
public class LogModel
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public DateTime Timestamp { get; set; }
|
||||
|
||||
public LogLevel LogLevel { get; set; }
|
||||
|
||||
public EventId EventId { get; set; }
|
||||
|
||||
public object? State { get; set; }
|
||||
|
||||
public string? Exception { get; set; }
|
||||
|
||||
public LogEntryColor? Color { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user