Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
febbe6c
Initial plan
Copilot Feb 6, 2026
b9505b5
Work in Progress on Logging Refactor. (#178)
michaelbeale-IL Feb 7, 2026
5ebdff5
Convert BCIActuator.cs to use Microsoft.Extensions.Logging
Copilot Feb 7, 2026
540325b
Fix exception logging and spelling errors in BCIActuator.cs
Copilot Feb 7, 2026
bdb2b93
Fix empty LogTrace call and spelling error in BCIActuator.cs
Copilot Feb 7, 2026
ee30858
Adjust log severity levels based on code review
Copilot Feb 7, 2026
ce0ec44
Remove redundant exception messages from LogError calls
Copilot Feb 7, 2026
5d4d9eb
Improve exception log messages and fix formatting
Copilot Feb 7, 2026
27852cc
Replace redundant exception messages with contextual descriptions
Copilot Feb 7, 2026
c40c38b
Use structured logging and fix commented code
Copilot Feb 7, 2026
219de64
Convert AnimationPlayer.cs to use Microsoft.Extensions.Logging
Copilot Feb 7, 2026
f48a5c2
Convert AgentManager to Microsoft.Extensions.Logging
Copilot Feb 7, 2026
27eac78
Improve LogTrace calls with descriptive messages
Copilot Feb 7, 2026
b88bc28
Convert PanelStack.cs to use Microsoft.Extensions.Logging
Copilot Feb 7, 2026
f5372e2
Convert DAQ_OpenBCI.cs to use Microsoft.Extensions.Logging
Copilot Feb 7, 2026
b0c3e9b
Convert TextUtils.cs to use Microsoft.Extensions.Logging
Copilot Feb 7, 2026
c982e85
Convert ScannerCommon.cs to use Microsoft.Extensions.Logging
Copilot Feb 7, 2026
ff8f6d3
Convert ActuatorManager.cs to use Microsoft.Extensions.Logging
Copilot Feb 7, 2026
49b0321
Convert DAQ_gTecBCI.cs to use Microsoft.Extensions.Logging
Copilot Feb 7, 2026
38e0a41
Convert UserControlBCISignalCheck to use Microsoft.Extensions.Logging
Copilot Feb 7, 2026
a9ea04f
Merge branch 'master' into copilot/migrate-log-debug-to-logger
michaelbeale-IL Feb 8, 2026
6b72916
Removed unecessary verbose log messages.
michaelbeale-IL Feb 8, 2026
889e565
Convert Log.* calls to ILogger pattern in 9 files
Copilot Feb 8, 2026
e673fa0
Fix redundant exception logging in PreferredAgents and DimReductChanSel
Copilot Feb 8, 2026
68e4141
Fix redundant exception message and mark logger as NonSerialized
Copilot Feb 8, 2026
d2bdc5a
Remove redundant initialization log message in PreferredAgents
Copilot Feb 8, 2026
3825c24
Add null check for logger in DimReductChanSel after deserialization
Copilot Feb 8, 2026
0865d3f
Convert Log.* calls to ILogger in 10 ACATCore files
Copilot Feb 8, 2026
943abf3
Convert Log.* calls to ILogger pattern in 10 ACATCore files
Copilot Feb 8, 2026
c2b75e9
Use LoggingConfiguration.CreateLogger for static loggers in ProfileMa…
Copilot Feb 8, 2026
c34e038
Improve error message clarity in LayoutAttribute widget instantiation
Copilot Feb 8, 2026
8634341
Convert Log.* calls to ILogger pattern in 6 files
Copilot Feb 8, 2026
1071b0b
Convert Log.* calls to ILogger pattern in 10 files
Copilot Feb 8, 2026
f6e989f
Convert Log.* calls to ILogger pattern in 10 files
Copilot Feb 8, 2026
756947f
Convert Log.* calls to ILogger pattern in 10 files
Copilot Feb 8, 2026
1c7b6e7
Convert Log.* calls to ILogger pattern in 10 files
Copilot Feb 8, 2026
538dea7
Convert Log.* calls to ILogger pattern in 6 files (94 calls total)
Copilot Feb 8, 2026
7668faf
Convert Log.* calls to ILogger pattern in TextControlAgentBase
Copilot Feb 8, 2026
ea18605
Convert TalkApplicationBCIScanner to ILogger pattern
Copilot Feb 8, 2026
a7ea383
Convert FeatureExtraction.cs to ILogger pattern
Copilot Feb 8, 2026
45ae3ea
Convert Log calls to ILogger in TextController.cs
Copilot Feb 8, 2026
61f0b08
Fix spelling in parameter name and improve LogTrace message
Copilot Feb 8, 2026
6a9fcff
Fix double space in log message template
Copilot Feb 8, 2026
174ef17
Convert CameraActuator logging to ILogger
Copilot Feb 8, 2026
5adec61
Convert PanelAnimationManager to use ILogger with structured logging
Copilot Feb 8, 2026
d685829
Convert logging in OpenBCIDeviceTester.cs to Microsoft.Extensions.Log…
Copilot Feb 8, 2026
0c35d36
Convert Log.Debug to _logger.LogDebug in SensorForm.cs
Copilot Feb 8, 2026
e8f0e23
Convert all 26 Log calls to ILogger in DecisionMaker.cs
Copilot Feb 8, 2026
22b93cc
Use NullLogger singleton for efficient default logger
Copilot Feb 8, 2026
94c08ce
Rename _defaultLogger to _nullLogger for clarity
Copilot Feb 8, 2026
c780c15
Convert 26 Log calls to ILogger in UserControlAnimationManager
Copilot Feb 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Applications/ACATConfigNext/Forms/SettingsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private void ButtonClicked_Save(object sender, EventArgs e)
}
catch (Exception ex)
{
Log.Exception(ex);
_logger.LogError(ex, "Error occurred while saving settings");
MessageBox.Show("An error occurred while saving settings.", "Save Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using ACAT.Extensions.Onboarding.UI.UserControls;
using ACAT.Extensions.Onboarding.UI;
using ACAT.Core.CoreInterfaces;
using Microsoft.Extensions.Logging;
using System.Globalization;

namespace ACAT.Extensions.Onboarding.Onboarding
Expand All @@ -25,8 +26,14 @@ public class OnboardingLanguageSelect : OnboardingExtensionBase
// TODO - Localize Me
private const string Step1 = "STEP 1";

private readonly ILogger<OnboardingLanguageSelect> _logger;
private IOnboardingWizard _wizard;

public OnboardingLanguageSelect()
{
_logger = LoggingConfiguration.CreateLogger<OnboardingLanguageSelect>();
}

public override ClassDescriptorAttribute Descriptor
{
get { return ClassDescriptorAttribute.GetDescriptor(GetType()); }
Expand Down Expand Up @@ -85,7 +92,7 @@ public override void OnEndStep(IOnboardingUserControl userControl, Reason reason
{
case Step1:
var cultureInfo = userControlLang.currentCulture;
Log.Debug ("User selected language: " + cultureInfo.DisplayName);
_logger.LogDebug("User selected language: {LanguageName}", cultureInfo.DisplayName);

CoreGlobals.AppPreferences.Language = cultureInfo.TwoLetterISOLanguageName;
CoreGlobals.AppPreferences.Save();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ private void UserControlHardwareSwitchSetup_Load(object sender, EventArgs e)
}

String html = String.Format(_htmlTemplate, headStyle, bodyStyle, textStyle, "Click <a href=" + HtmlUtils.EncodeString(CoreGlobals.ACATUserGuideFileName) + "#" + bookmark + ">here</a> for help");
Log.Debug(html);
_logger.LogDebug("Generated HTML: {Html}", html);

webBrowser.DocumentText = html;
//webBrowser.DocumentText =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ private void WebBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs
{
var str = e.Url.ToString();

Log.Debug("Url is [" + str + "]");
_logger.LogDebug("Url is [{Url}]", str);

if (str.ToLower().Contains("blank"))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using ACAT.Core.Utility;
using ACAT.Core.WidgetManagement;
using ACAT.Extension.UI.UserControls;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.ComponentModel;
Expand All @@ -13,6 +14,7 @@ namespace ACAT.Extensions.UI.UserControls.Toolbars
[DesignerCategory("code")]
public abstract class LargeToolbarUserControl : KeyboardUserControl
{
private readonly ILogger<LargeToolbarUserControl> _logger;
private readonly TableLayoutPanel ToolbarBox = new()
{
Name = "ToolbarBox",
Expand Down Expand Up @@ -55,6 +57,7 @@ protected class ButtonSpec
}
public LargeToolbarUserControl(string name)
{
_logger = LoggingConfiguration.CreateLogger<LargeToolbarUserControl>();
Name = name;
InitializeButtonsList();
InitializeComponent();
Expand Down Expand Up @@ -154,7 +157,7 @@ protected virtual void InitializeComponent()

protected override void OnPaint(PaintEventArgs e)
{
Log.Debug($"{e.Graphics.DpiX} x {e.Graphics.DpiY}");
_logger.LogDebug("{DpiX} x {DpiY}", e.Graphics.DpiX, e.Graphics.DpiY);

e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
base.OnPaint(e);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using ACAT.Core.PanelManagement;
using ACAT.Core.Utility;
using ACAT.Core.WidgetManagement;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.ComponentModel;
Expand All @@ -14,6 +15,8 @@ namespace ACAT.Extensions.UI.UserControls.Toolbars
[DesignerCategory("code")]
public class LaunchAppUserControl : LargeToolbarUserControl
{
private static readonly ILogger<LaunchAppUserControl> _logger = LoggingConfiguration.CreateLogger<LaunchAppUserControl>();

private class LaunchButtonSpec : ButtonSpec
{
public AppInfo AppInfo { get; set; }
Expand Down Expand Up @@ -51,7 +54,7 @@ public LaunchAppUserControl() : base("LaunchAppUserControl")
public override void OnButtonClicked(object s, EventArgs e)
{
string buttonName = e.ToString();
Log.Info($"Button clicked: {buttonName}");
_logger.LogInformation("Button clicked: {ButtonName}", buttonName);

var dict = Buttons.ToDictionary(x => x.Name);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
using ACAT.Extensions.BCI.Common.BCIInterfaceUtilities;
using ACAT.Extensions.BCI.UI.UserControls;
using ACATResources;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -65,6 +66,11 @@ public partial class TalkApplicationBCIScanner : Form, IScannerPanel, ISupportsS
/// </summary>
private readonly Dispatcher _dispatcher;

/// <summary>
/// Logger instance for this class
/// </summary>
private readonly ILogger<TalkApplicationBCIScanner> _logger;

/// <summary>
/// The AlphabetScannerCommon object. Has a number of
/// helper functions
Expand Down Expand Up @@ -187,8 +193,9 @@ public partial class TalkApplicationBCIScanner : Form, IScannerPanel, ISupportsS
/// <summary>
/// Initializes a new instance of the class.
/// </summary>
public TalkApplicationBCIScanner()
public TalkApplicationBCIScanner(ILogger<TalkApplicationBCIScanner> logger = null)
{
_logger = logger;
_scannerCommon = new ScannerCommon(this);
InitializeComponent();
this.DoubleBuffered = true;
Expand Down Expand Up @@ -737,7 +744,7 @@ private void BciActuator_EvtIoctlResponse(int opcode, object response)
{
if (!_RequestCalibration)//have a delay before start typing so the user can see the options and suggestions and start looking where is desired
{
Log.Debug("BCI LOG | Delay before Typing ");//Run the delay in another therad to avoid blocking the UI
_logger?.LogDebug("BCI LOG | Delay before Typing ");//Run the delay in another therad to avoid blocking the UI
_ = ShowTimedMessageBoxAsync().ConfigureAwait(false);
}
else
Expand All @@ -752,14 +759,14 @@ private void BciActuator_EvtIoctlResponse(int opcode, object response)
if (_BCIState == BCIState.BCIStartSession)
{
_BCIState = BCIState.BCIInitDone;
Log.Debug("BCI LOG | BCI Init state: " + BCIState.BCIInitDone);
_logger?.LogDebug("BCI LOG | BCI Init state: {State}", BCIState.BCIInitDone);
}
break;

case (int)OpCodes.SendCalibrationStatus:
//STEP - 1
var bciCalibrationStatus = response as BCICalibrationStatus;
Log.Debug("BCI LOG | bciCalibrationStatus.OkToGoToTyping: " + bciCalibrationStatus.OkToGoToTyping);
_logger?.LogDebug("BCI LOG | bciCalibrationStatus.OkToGoToTyping: {OkToGoToTyping}", bciCalibrationStatus.OkToGoToTyping);
if (_ShowMainOptions)//This window should only display once
{
_ShowMainOptions = false;
Expand Down Expand Up @@ -988,7 +995,7 @@ private void BCIShowRecalibrationWindowMessage()
}
catch (Exception es)
{
Log.Exception("BCI LOG | " + es.Message.ToString());
_logger?.LogError("BCI LOG | {Message}", es.Message.ToString());
}
}

Expand All @@ -1006,40 +1013,40 @@ private void BCIUpdateBCI(BCIState bCIState)
break;

case BCIState.UIRefresh://1 Init state
Log.Debug("BCI LOG | BCI Init state: " + BCIState.UIRefresh);
_logger?.LogDebug("BCI LOG | BCI Init state: {State}", BCIState.UIRefresh);
_BCIState = BCIState.UIRefresh;
_ = ControlsUIAdjustment().ConfigureAwait(false);
break;

case BCIState.Initializing://2 Init state
Log.Debug("BCI LOG | BCI Init state: " + BCIState.Initializing);
_logger?.LogDebug("BCI LOG | BCI Init state: {State}", BCIState.Initializing);
_BCIState = BCIState.Initializing;
_ = InitializeBCI().ConfigureAwait(false);
break;

case BCIState.ReqCalibrationStatus://3 Init state
_BCIState = BCIState.ReqCalibrationStatus;
Log.Debug("BCI LOG | BCI Init state: " + BCIState.ReqCalibrationStatus);
_logger?.LogDebug("BCI LOG | BCI Init state: {State}", BCIState.ReqCalibrationStatus);
_ = BCIRequestCalibrationStatus().ConfigureAwait(false);
break;

case BCIState.StartBCIReqParams://4 Init state
//STEP - 4
Log.Debug("BCI LOG | BCI Init state: " + BCIState.StartBCIReqParams);
_logger?.LogDebug("BCI LOG | BCI Init state: {State}", BCIState.StartBCIReqParams);
_BCIState = BCIState.StartBCIReqParams;
_ = BCIStartBCIReqParams().ConfigureAwait(false);
break;

case BCIState.BCIStartSession://5 Init state
Log.Debug("BCI LOG | BCI Init state: " + BCIState.BCIStartSession);
_logger?.LogDebug("BCI LOG | BCI Init state: {State}", BCIState.BCIStartSession);
_BCIState = BCIState.BCIStartSession;
_ = BCIStartSession().ConfigureAwait(false);
break;
}
}
catch (Exception ex)
{
Log.Exception("BCI LOG | Error in BCI Init state: " + bCIState + " Messagge: " + ex.Message);
_logger?.LogError("BCI LOG | Error in BCI Init state: {State} Message: {Message}", bCIState, ex.Message);
}
}

Expand Down Expand Up @@ -1129,7 +1136,7 @@ private void ExitApplication()
}
catch (Exception e)
{
Log.Exception("BCI LOG | Error in ExitApplication() BCI: " + e.Message);
_logger?.LogError("BCI LOG | Error in ExitApplication() BCI: {Message}", e.Message);
}
}

Expand Down Expand Up @@ -1250,8 +1257,8 @@ private void LearnCannedPhrases(string textToLearn)
private void LogAssemblyVersion()
{
var version = ACATPreferences.ApplicationAssembly.GetName().Version.Major + "." + ACATPreferences.ApplicationAssembly.GetName().Version.Minor;
Log.Debug("BCI LOG | ACAT - Assembly version info");
Log.Debug("BCI LOG | AssemblyVersion: " + version);
_logger?.LogDebug("BCI LOG | ACAT - Assembly version info");
_logger?.LogDebug("BCI LOG | AssemblyVersion: {Version}", version);
}

/// <summary>
Expand Down Expand Up @@ -1348,7 +1355,7 @@ private void SetCaretPositionForTextBoxUC(UserControl userControl, Control panel
if (BCIInterfaceUtils.GetCaretPositionOfTextBoxUC() != currentCaretPosition)
{
Windows.SetCaretPosition(_textBoxTalkWindow, BCIInterfaceUtils.GetCaretPositionOfTextBoxUC());
Log.Debug("BCI LOG | Caret position reestablish | Textbox user control changed");
_logger?.LogDebug("BCI LOG | Caret position reestablish | Textbox user control changed");
}
}
}
Expand All @@ -1359,14 +1366,14 @@ private void SetCaretPositionForTextBoxUC(UserControl userControl, Control panel
if (BCIInterfaceUtils.GetCaretPhrasePositionOfTextBoxUC() != currentCaretPosition)
{
Windows.SetCaretPosition(_textBoxTalkWindow, BCIInterfaceUtils.GetCaretPhrasePositionOfTextBoxUC());
Log.Debug("BCI LOG | Caret position reestablish | Textbox user control changed");
_logger?.LogDebug("BCI LOG | Caret position reestablish | Textbox user control changed");
}
}
}
}
catch (Exception ex)
{
Log.Debug("BCI LOG | Error | SetCaretPositionForTextBoxUC: " + ex.Message);
_logger?.LogDebug("BCI LOG | Error | SetCaretPositionForTextBoxUC: {Message}", ex.Message);
}
}

Expand Down Expand Up @@ -1540,7 +1547,7 @@ private void TextBoxTalkWindowOnKeyPress(object sender, KeyPressEventArgs keyPre
}
catch (Exception ex)
{
Log.Exception(ex);
_logger?.LogError(ex, ex.Message);
}
}

Expand All @@ -1552,9 +1559,9 @@ private void TextToSpeech(String text)
{
if (!String.IsNullOrEmpty(text))
{
Log.Debug("*** TTS *** : " + text);
_logger?.LogDebug("*** TTS *** : {Text}", text);
TTSManager.Instance.ActiveEngine.Speak(text);
Log.Debug("*** TTS *** : sent text!");
_logger?.LogDebug("*** TTS *** : sent text!");

AuditLog.Audit(new AuditEventTextToSpeech(TTSManager.Instance.ActiveEngine.Descriptor.Name));
}
Expand Down Expand Up @@ -1660,7 +1667,7 @@ public override bool Execute(ref bool handled)
{
handled = true;
List<Widget>[] widgets;
Log.Debug("BCI LOG | Command | selected | Pressed | " + Command.ToString());
_logger?.LogDebug("BCI LOG | Command | selected | Pressed | {Command}", Command.ToString());
switch (Command)
{
case "CmdEditScanner":
Expand Down Expand Up @@ -1871,7 +1878,7 @@ public override bool Execute(ref bool handled)
}
}
else
Log.Debug("BCI LOG | Command | selected | Pressed in calibration | No action | " + Command.ToString());
_logger?.LogDebug("BCI LOG | Command | selected | Pressed in calibration | No action | {Command}", Command.ToString());
return true;
}
}
Expand Down
Loading