Code · 23 lines · 946 bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23using Microsoft.Extensions.Logging;

namespace MailSharp.MailClient.Models;

public class LogEntry
{
	public int Id { get; set; }
	public DateTime Timestamp { get; set; }
	public LogLevel Level { get; set; }
	public string Category { get; set; } = "";
	public string Message { get; set; } = "";
	public string? Exception { get; set; }
	public int? EventId { get; set; }

	// Pulled out of ScopeData (when present) into its own indexed field so filtering by account in
	// the Maintenance log viewer doesn't need to scan/deserialize every ScopeData dictionary.
	public int? AccountId { get; set; }

	// Flattened BeginScope() values (accountId, folder, durationMs, ...) - keys/values are always
	// stringified since scope state can be any shape (anonymous objects, dictionaries, tuples) and
	// LiteDB needs a stable, queryable document shape rather than arbitrary nested state.
	public Dictionary<string, string> ScopeData { get; set; } = [];
}