Skip to content

Commit

Permalink
The most significant changes in the code are related to the logging m…
Browse files Browse the repository at this point in the history
…essages in the `TimeProcessAccessPolicyCheck_Tick` method in the `MainForm.cs` file. The variables `_loggerExecutingText` and `_loggerExecutedText` that were previously used to format the log messages have been replaced with hardcoded strings. The `nameof` operator is used to get the string name of the method, which is inserted into the log message. These changes are only included in the compiled code if the `DEBUG` symbol is not defined.

List of changes:

1. In the `MainForm.cs` file, the logging messages in the `TimeProcessAccessPolicyCheck_Tick` method have been modified. The `_loggerExecutingText` and `_loggerExecutedText` variables have been replaced with hardcoded strings "Executing {e}." and "Executed {e}.", respectively (reference: `MainForm.cs`).
2. The `nameof` operator is used to get the string name of the `TimeProcessAccessPolicyCheck_Tick` method, which is inserted into the log message at the `{e}` placeholder (reference: `MainForm.cs`).
3. These changes are wrapped in a `#if !(DEBUG)` preprocessor directive, meaning they will only be included in the compiled code if the `DEBUG` symbol is not defined. This is typically used to include or exclude code for debugging purposes (reference: `MainForm.cs`).
  • Loading branch information
amgdy committed Mar 29, 2024
1 parent 483fee1 commit 1a6ab8e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Magdys.ScreenPrivacyWatermark.App/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private void TimeProcessAccessPolicyCheck_Tick(object sender, EventArgs e)
{

#if !(DEBUG)
_logger.LogTrace(_loggerExecutingText, nameof(TimeProcessPolicyCheck_Tick), Text);
_logger.LogTrace("Executing {e}.", nameof(TimeProcessAccessPolicyCheck_Tick));
#endif
if (_processAccessPolicyOptions.AllowedProcessesList.Length == 0)
{
Expand Down Expand Up @@ -226,7 +226,7 @@ private void TimeProcessAccessPolicyCheck_Tick(object sender, EventArgs e)


#if !(DEBUG)
_logger.LogTrace(_loggerExecutedText, nameof(TimeProcessPolicyCheck_Tick), Text);
_logger.LogTrace("Executed {e}.", nameof(TimeProcessAccessPolicyCheck_Tick));
#endif

}
Expand Down

0 comments on commit 1a6ab8e

Please sign in to comment.