-
Notifications
You must be signed in to change notification settings - Fork 25
/
DebugWindowLoggerOptions.cs
134 lines (120 loc) · 4.43 KB
/
DebugWindowLoggerOptions.cs
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
using System.Text.Json;
using System.Diagnostics;
using System.Text.Encodings.Web;
using System.Collections.Generic;
using Microsoft.Extensions.Hosting;
using Macross.Logging;
namespace Macross.Windows.Debugging
{
/// <summary>
/// Stores options for the <see cref="DebugWindow"/>.
/// </summary>
public class DebugWindowLoggerOptions
{
/// <summary>
/// Gets the default <see cref="LoggerGroupOptions"/> filters used to group log messages by category.
/// </summary>
/// <remarks>
/// Default settings are constructed as:
/// <code><![CDATA[
/// new LoggerGroupOptions[]
/// {
/// new LoggerGroupOptions
/// {
/// GroupName = "System",
/// CategoryNameFilters = new string[] { "System*" }
/// },
/// new LoggerGroupOptions
/// {
/// GroupName = "Microsoft",
/// CategoryNameFilters = new string[] { "Microsoft*" }
/// },
/// };
/// ]]></code>
/// </remarks>
public static IEnumerable<LoggerGroupOptions> DefaultGroupOptions { get; } = new LoggerGroupOptions[]
{
new LoggerGroupOptions
{
GroupName = "System",
CategoryNameFilters = new string[] { "System*" }
},
new LoggerGroupOptions
{
GroupName = "Microsoft",
CategoryNameFilters = new string[] { "Microsoft*" }
},
};
/// <summary>
/// Gets the default <see cref="JsonSerializerOptions"/> options to use when displaying messages.</summary>
/// <remarks>
/// Default settings are constructed as:
/// <code><![CDATA[
/// new JsonSerializerOptions
/// {
/// IgnoreNullValues = true,
/// WriteIndented = true,
/// Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
/// };
/// ]]></code>
/// </remarks>
public static JsonSerializerOptions DefaultJsonOptions { get; } = new JsonSerializerOptions
{
IgnoreNullValues = true,
WriteIndented = true,
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
};
/// <summary>
/// Gets or sets a value indicating whether or not the debugger should be launched on startup if it isn't already attached. Default value: False.
/// </summary>
/// <remarks>
/// This is primarily for starting applications in debug via the command-line.
/// </remarks>
public bool LaunchDebuggerIfNotAttached { get; set; }
/// <summary>
/// Gets or sets a value indicating whether or not the <see cref="DebugWindow"/> should be shown. Default value: Show if the debugger is attached.
/// </summary>
/// <remarks>
/// This is primarily for starting applications with the debug interface via the command-line.
/// </remarks>
public bool ShowDebugWindow { get; set; } = Debugger.IsAttached;
/// <summary>
/// Gets or sets a value indicating whether or not any parent console window will be hidden when showing the <see cref="DebugWindow"/>. Default value: True.
/// </summary>
public bool HideConsoleIfAttachedWhenShowingWindow { get; set; } = true;
/// <summary>
/// Gets or sets the title string that should be displayed in the <see cref="DebugWindow"/>. If not supplied the <see cref="IHostEnvironment.ApplicationName"/> value will be used.
/// </summary>
public string? WindowTitle { get; set; }
/// <summary>
/// Gets or sets the <see cref="DebugWindow"/> width in pixels. Default value: 1024.
/// </summary>
public int WindowWidth { get; set; } = 1024;
/// <summary>
/// Gets or sets the <see cref="DebugWindow"/> height in pixels. Default value: 768.
/// </summary>
public int WindowHeight { get; set; } = 768;
/// <summary>
/// Gets or sets a value indicating whether or not the <see cref="DebugWindow"/> should start minimized. Default value: False.
/// </summary>
public bool StartMinimized { get; set; }
/// <summary>
/// Gets or sets a value indicating whether or not the <see cref="DebugWindow"/> should minimize to the system tray. Default value: False.
/// </summary>
public bool MinimizeToSystemTray { get; set; }
/// <summary>
/// Gets or sets the filters to use to group log messages by category.
/// </summary>
/// <remarks>
/// See <see cref="DefaultGroupOptions"/> for default values.
/// </remarks>
public IEnumerable<LoggerGroupOptions>? GroupOptions { get; set; }
/// <summary>
/// Gets or sets the <see cref="JsonSerializerOptions"/> to use when displaying messages.
/// </summary>
/// <remarks>
/// See <see cref="DefaultJsonOptions"/> for default values.
/// </remarks>
public JsonSerializerOptions? JsonOptions { get; set; }
}
}