Skip to content

Commit ddce528

Browse files
📝 Add docstrings to debug-log-level
Docstrings generation was requested by @VictoriousRaptor. * #2739 (comment) The following files were modified: * `Flow.Launcher.Infrastructure/Logger/Log.cs` * `Flow.Launcher/App.xaml.cs`
1 parent 8d3fd75 commit ddce528

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

Flow.Launcher.Infrastructure/Logger/Log.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Diagnostics;
1+
using System.Diagnostics;
22
using System.IO;
33
using System.Runtime.CompilerServices;
44
using NLog;
@@ -16,6 +16,14 @@ public static class Log
1616

1717
public static string CurrentLogDirectory { get; }
1818

19+
/// <summary>
20+
/// Initializes the logging infrastructure for the Log class by configuring the log directory and NLog targets.
21+
/// </summary>
22+
/// <remarks>
23+
/// This static constructor sets up the current log directory based on the application's data directory, ensuring it exists before any logging occurs.
24+
/// It configures an asynchronous file logging target with a predefined message layout and, in debug builds, an additional debug output target.
25+
/// Logging rules are established for both targets to ensure a consistent logging format throughout the application.
26+
/// </remarks>
1927
static Log()
2028
{
2129
CurrentLogDirectory = Path.Combine(DataLocation.DataDirectory(), DirectoryName, Constant.Version);
@@ -63,18 +71,31 @@ static Log()
6371
LogManager.Configuration = configuration;
6472
}
6573

74+
/// <summary>
75+
/// Configures the file logging rule to capture logs from Debug to Fatal.
76+
/// </summary>
77+
/// <remarks>
78+
/// This method updates the logging configuration by locating the rule named "file" and setting its logging levels to include Debug messages, ensuring detailed log output. It then logs an informational message indicating that the DEBUG log level is now active.
79+
/// </remarks>
6680
public static void UseDebugLogLevel()
6781
{
6882
LogManager.Configuration.FindRuleByName("file").SetLoggingLevels(LogLevel.Debug, LogLevel.Fatal);
6983
Info(nameof(Logger), "Using DEBUG log level.");
7084
}
7185

86+
/// <summary>
87+
/// Configures the file logging target to record messages from Info to Fatal level and logs an informational message indicating that the INFO log level is in use.
88+
/// </summary>
7289
public static void UseInfoLogLevel()
7390
{
7491
LogManager.Configuration.FindRuleByName("file").SetLoggingLevels(LogLevel.Info, LogLevel.Fatal);
7592
Info(nameof(Logger), "Using INFO log level.");
7693
}
7794

95+
/// <summary>
96+
/// Logs a fatal error indicating that a log message does not adhere to the expected format.
97+
/// </summary>
98+
/// <param name="message">The original log message that failed to meet the required format.</param>
7899
private static void LogFaultyFormat(string message)
79100
{
80101
var logger = LogManager.GetLogger("FaultyLogger");

Flow.Launcher/App.xaml.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Diagnostics;
33
using System.Text;
44
using System.Threading;
@@ -108,6 +108,15 @@ public static void Main()
108108
}
109109
}
110110

111+
/// <summary>
112+
/// Asynchronously executes the startup initialization sequence for the application.
113+
/// </summary>
114+
/// <remarks>
115+
/// This method performs pre-start cleanup, registers global exception handlers, configures logging
116+
/// based on user settings, initializes images and plugins, and sets up internationalization and theme settings.
117+
/// It also creates and displays the main window while registering exit events and enabling auto-startup and
118+
/// periodic update checks to ensure a fully configured runtime environment.
119+
/// </remarks>
111120
private async void OnStartupAsync(object sender, StartupEventArgs e)
112121
{
113122
await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () =>

0 commit comments

Comments
 (0)