Skip to content

Commit 62a0886

Browse files
author
lampenlampen
authored
Log statements in DriveManager (#433)
* Add Log statements to DriveManager
1 parent 5d62ca9 commit 62a0886

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Files/Filesystem/Drives.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@
1313
using Windows.Storage;
1414
using Windows.UI.Core;
1515
using Windows.UI.Xaml;
16+
using NLog;
1617

1718
namespace Files.Filesystem
1819
{
1920
public class DrivesManager
2021
{
22+
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
23+
2124
public ObservableCollection<DriveItem> Drives { get; } = new ObservableCollection<DriveItem>();
2225
public bool ShowUserConsentOnInit { get; set; } = false;
2326
private DeviceWatcher _deviceWatcher;
@@ -84,6 +87,8 @@ private async void DeviceAdded(DeviceWatcher sender, DeviceInformation args)
8487
Visibility.Visible,
8588
type);
8689

90+
Logger.Info($"Drive added: {driveItem.tag}");
91+
8792
// Update the collection on the ui-thread.
8893
try
8994
{
@@ -107,6 +112,8 @@ private async void DeviceRemoved(DeviceWatcher sender, DeviceInformationUpdate a
107112
continue;
108113
}
109114

115+
Logger.Info($"Drive removed: {drive.tag}");
116+
110117
// Update the collection on the ui-thread.
111118
try
112119
{
@@ -186,6 +193,8 @@ private void GetDrives(IList<DriveItem> list)
186193
Visibility.Visible,
187194
type);
188195

196+
Logger.Info($"Drive added: {driveItem.tag}");
197+
189198
list.Add(driveItem);
190199
}
191200
}

Files/Settings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ public static class LocalSettings
1111
public const string DateTimeFormat = "datetimeformat";
1212
public const string Theme = "theme";
1313
}
14-
}
14+
}

0 commit comments

Comments
 (0)