Skip to content

Commit dcc8b0a

Browse files
blackspherefollowerqdot
authored andcommitted
Promoting various logging events
This should reduce the need to get swamped by the trace level logging, and bubble up issues that might have been lost at debug. Fixes #199
1 parent 4b31312 commit dcc8b0a

8 files changed

Lines changed: 19 additions & 19 deletions

File tree

Buttplug.Client/ButtplugWSClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public ButtplugWSClient(string aClientName)
8383
_bpLogManager = new ButtplugLogManager();
8484
_bpLogger = _bpLogManager.GetLogger(GetType());
8585
_parser = new ButtplugJsonMessageParser(_bpLogManager);
86-
_bpLogger.Trace("Finished setting up ButtplugClient");
86+
_bpLogger.Info("Finished setting up ButtplugClient");
8787
_owningDispatcher = Dispatcher.CurrentDispatcher;
8888
_tokenSource = new CancellationTokenSource();
8989
}

Buttplug.Components.Controls/ButtplugTabControl.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ private ButtplugServer InitializeButtplugServer(string aServerName, uint aMaxPin
116116
}
117117
catch (PlatformNotSupportedException e)
118118
{
119-
_guiLog.Warn(e, "Something went wrong whilst setting up bluetooth.");
119+
_guiLog.Error(e, "Something went wrong whilst setting up bluetooth.");
120120
}
121121
}
122122
else
@@ -209,12 +209,12 @@ public void SetServerDetails(string serverName, uint maxPingTime)
209209
}
210210
catch (Exception)
211211
{
212-
_guiLog.Error("Cannot retreive Release ID for OS! Will not load bluetooth manager.");
212+
_guiLog.Warn("Cannot retreive Release ID for OS! Will not load bluetooth manager.");
213213
}
214214

215215
if (!UWPBluetoothManager.HasRegistryKeysSet())
216216
{
217-
_guiLog.Error("Registry keys not set for UWP bluetooth API security. This may cause Bluetooth devices to not be seen.");
217+
_guiLog.Warn("Registry keys not set for UWP bluetooth API security. This may cause Bluetooth devices to not be seen.");
218218

219219
// Only show this if we're running a full application.
220220
if (Application.Current != null)

Buttplug.Core/ButtplugJsonMessageParser.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class ButtplugJsonMessageParser
2424
public ButtplugJsonMessageParser([NotNull] IButtplugLogManager aLogManager)
2525
{
2626
_bpLogger = aLogManager.GetLogger(GetType());
27-
_bpLogger.Debug($"Setting up {GetType().Name}");
27+
_bpLogger.Info($"Setting up {GetType().Name}");
2828
IEnumerable<Type> allTypes;
2929

3030
// Some classes in the library may not load on certain platforms due to missing symbols.
@@ -84,7 +84,7 @@ public ButtplugMessage[] Deserialize(string aJsonMsg)
8484
}
8585
catch (JsonReaderException e)
8686
{
87-
res.Add(_bpLogger.LogErrorMsg(ButtplugConsts.SystemMsgId, ErrorClass.ERROR_MSG, "Not valid JSON"));
87+
res.Add(_bpLogger.LogErrorMsg(ButtplugConsts.SystemMsgId, ErrorClass.ERROR_MSG, $"Not valid JSON: {aJsonMsg} - {e.Message}"));
8888
return res.ToArray();
8989
}
9090

Buttplug.Server.Managers.UWPBluetoothManager/UWPBluetoothManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static bool HasRegistryKeysSet()
3535
public UWPBluetoothManager(IButtplugLogManager aLogManager)
3636
: base(aLogManager)
3737
{
38-
BpLogger.Debug("Loading UWP Bluetooth Manager");
38+
BpLogger.Info("Loading UWP Bluetooth Manager");
3939
_currentlyConnecting = new List<ulong>();
4040

4141
// Introspect the ButtplugDevices namespace for all Factory classes, then create instances of all of them.
@@ -120,19 +120,19 @@ where x.MayBeDevice(aEvent.Advertisement)
120120
private void OnWatcherStopped(BluetoothLEAdvertisementWatcher aObj,
121121
BluetoothLEAdvertisementWatcherStoppedEventArgs aEvent)
122122
{
123-
BpLogger.Trace("Stopped BLE Scanning");
123+
BpLogger.Info("Stopped BLE Scanning");
124124
InvokeScanningFinished();
125125
}
126126

127127
public override void StartScanning()
128128
{
129-
BpLogger.Trace("Starting BLE Scanning");
129+
BpLogger.Info("Starting BLE Scanning");
130130
_bleWatcher.Start();
131131
}
132132

133133
public override void StopScanning()
134134
{
135-
BpLogger.Trace("Stopping BLE Scanning");
135+
BpLogger.Info("Stopping BLE Scanning");
136136
_bleWatcher.Stop();
137137
}
138138

Buttplug.Server.Managers.XInputGamepadManager/XInputGamepadManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ public class XInputGamepadManager : DeviceSubtypeManager
88
public XInputGamepadManager(IButtplugLogManager aLogManager)
99
: base(aLogManager)
1010
{
11-
BpLogger.Debug("Loading XInput Gamepad Manager");
11+
BpLogger.Info("Loading XInput Gamepad Manager");
1212
}
1313

1414
public override void StartScanning()
1515
{
16-
BpLogger.Trace("XInputGamepadManager start scanning");
16+
BpLogger.Info("XInputGamepadManager start scanning");
1717
var controllers = new[]
1818
{
1919
new Controller(UserIndex.One),
@@ -38,7 +38,7 @@ public override void StartScanning()
3838
public override void StopScanning()
3939
{
4040
// noop
41-
BpLogger.Trace("XInputGamepadManager stop scanning");
41+
BpLogger.Info("XInputGamepadManager stop scanning");
4242
}
4343

4444
public override bool IsScanning()

Buttplug.Server/ButtplugServer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public ButtplugServer([NotNull] string aServerName, uint aMaxPingTime, DeviceMan
7373

7474
_bpLogManager = new ButtplugLogManager();
7575
_bpLogger = _bpLogManager.GetLogger(GetType());
76-
_bpLogger.Trace("Setting up ButtplugServer");
76+
_bpLogger.Debug("Setting up ButtplugServer");
7777
_parser = new ButtplugJsonMessageParser(_bpLogManager);
7878
if (aDeviceManager != null)
7979
{
@@ -84,7 +84,7 @@ public ButtplugServer([NotNull] string aServerName, uint aMaxPingTime, DeviceMan
8484
_deviceManager = new DeviceManager(_bpLogManager);
8585
}
8686

87-
_bpLogger.Trace("Finished setting up ButtplugServer");
87+
_bpLogger.Info("Finished setting up ButtplugServer");
8888
_deviceManager.DeviceMessageReceived += DeviceMessageReceivedHandler;
8989
_deviceManager.ScanningFinished += ScanningFinishedHandler;
9090
_bpLogManager.LogMessageReceived += LogMessageReceivedHandler;

Buttplug.Server/DeviceManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public DeviceManager(IButtplugLogManager aLogManager)
3030
{
3131
_bpLogManager = aLogManager;
3232
_bpLogger = _bpLogManager.GetLogger(GetType());
33-
_bpLogger.Trace("Setting up DeviceManager");
33+
_bpLogger.Info("Setting up DeviceManager");
3434
_sentFinished = true;
3535
_devices = new Dictionary<uint, IButtplugDevice>();
3636
_deviceIndexCounter = 0;
@@ -59,11 +59,11 @@ private void DeviceAddedHandler(object aObj, DeviceAddedEventArgs aEvent)
5959
select x;
6060
if (duplicates.Any())
6161
{
62-
_bpLogger.Trace($"Already have device {aEvent.Device.Name} in Devices list");
62+
_bpLogger.Debug($"Already have device {aEvent.Device.Name} in Devices list");
6363
return;
6464
}
6565

66-
_bpLogger.Debug($"Adding Device {aEvent.Device.Name} at index {deviceIndex}");
66+
_bpLogger.Info($"Adding Device {aEvent.Device.Name} at index {deviceIndex}");
6767
_devices.Add(deviceIndex, aEvent.Device);
6868
aEvent.Device.DeviceRemoved += DeviceRemovedHandler;
6969
var msg = new DeviceAdded(deviceIndex, aEvent.Device.Name, GetAllowedMessageTypesAsStrings(aEvent.Device).ToArray());

Buttplug.Server/DeviceSubtypeManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ protected DeviceSubtypeManager([NotNull] IButtplugLogManager aLogManager)
1919
{
2020
LogManager = aLogManager;
2121
BpLogger = aLogManager.GetLogger(GetType());
22-
BpLogger.Trace($"Setting up Device Manager {GetType().Name}");
22+
BpLogger.Debug($"Setting up Device Manager {GetType().Name}");
2323
}
2424

2525
protected void InvokeDeviceAdded([NotNull] DeviceAddedEventArgs aEventArgs)

0 commit comments

Comments
 (0)