Skip to content

Commit f5b6005

Browse files
committed
Update logging messages to use consistent casing for placeholders
1 parent 26d4387 commit f5b6005

3 files changed

Lines changed: 25 additions & 25 deletions

File tree

HomeSpeaker.WebAssembly/Services/AnchorSyncService.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,37 +37,37 @@ public async Task StartAsync()
3737
// Subscribe to hub events
3838
_hubConnection.On<AnchorDefinition>("AnchorDefinitionCreated", (anchorDefinition) =>
3939
{
40-
_logger.LogInformation("Received anchor definition created: {name}", anchorDefinition.Name);
40+
_logger.LogInformation("Received anchor definition created: {Name}", anchorDefinition.Name);
4141
OnAnchorDefinitionCreated?.Invoke(anchorDefinition);
4242
});
4343

4444
_hubConnection.On<AnchorDefinition>("AnchorDefinitionUpdated", (anchorDefinition) =>
4545
{
46-
_logger.LogInformation("Received anchor definition updated: {name}", anchorDefinition.Name);
46+
_logger.LogInformation("Received anchor definition updated: {Name}", anchorDefinition.Name);
4747
OnAnchorDefinitionUpdated?.Invoke(anchorDefinition);
4848
});
4949

5050
_hubConnection.On<int>("AnchorDefinitionDeactivated", (anchorDefinitionId) =>
5151
{
52-
_logger.LogInformation("Received anchor definition deactivated: {id}", anchorDefinitionId);
52+
_logger.LogInformation("Received anchor definition deactivated: {Id}", anchorDefinitionId);
5353
OnAnchorDefinitionDeactivated?.Invoke(anchorDefinitionId);
5454
});
5555

5656
_hubConnection.On<UserAnchor>("UserAnchorAssigned", (userAnchor) =>
5757
{
58-
_logger.LogInformation("Received user anchor assigned: user {userId}, anchor {anchorId}", userAnchor.UserId, userAnchor.AnchorDefinitionId);
58+
_logger.LogInformation("Received user anchor assigned: user {UserId}, anchor {AnchorId}", userAnchor.UserId, userAnchor.AnchorDefinitionId);
5959
OnUserAnchorAssigned?.Invoke(userAnchor);
6060
});
6161

6262
_hubConnection.On<string, int>("UserAnchorRemoved", (userId, anchorDefinitionId) =>
6363
{
64-
_logger.LogInformation("Received user anchor removed: user {userId}, anchor {anchorId}", userId, anchorDefinitionId);
64+
_logger.LogInformation("Received user anchor removed: user {UserId}, anchor {AnchorId}", userId, anchorDefinitionId);
6565
OnUserAnchorRemoved?.Invoke(userId, anchorDefinitionId);
6666
});
6767

6868
_hubConnection.On<int, bool, DateTime?>("DailyAnchorCompletionUpdated", (dailyAnchorId, isCompleted, completedAt) =>
6969
{
70-
_logger.LogInformation("Received daily anchor completion updated: {dailyAnchorId}, completed: {isCompleted}", dailyAnchorId, isCompleted);
70+
_logger.LogInformation("Received daily anchor completion updated: {DailyAnchorId}, completed: {IsCompleted}", dailyAnchorId, isCompleted);
7171
OnDailyAnchorCompletionUpdated?.Invoke(dailyAnchorId, isCompleted, completedAt);
7272
});
7373

@@ -76,7 +76,7 @@ public async Task StartAsync()
7676
{
7777
if (error != null)
7878
{
79-
_logger.LogWarning("SignalR connection closed with error: {error}", error.Message);
79+
_logger.LogWarning("SignalR connection closed with error: {Error}", error.Message);
8080
}
8181
else
8282
{
@@ -90,7 +90,7 @@ public async Task StartAsync()
9090

9191
// Start connection
9292
await _hubConnection.StartAsync();
93-
_logger.LogInformation("SignalR connection started successfully to {url}", $"{anchorsApiAddress}/anchorHub");
93+
_logger.LogInformation("SignalR connection started successfully to {Url}", $"{anchorsApiAddress}/anchorHub");
9494

9595
// Join the anchor updates group
9696
await _hubConnection.SendAsync("JoinAnchorGroup");

HomeSpeaker.WebAssembly/Services/HomeSpeakerService.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class HomeSpeakerService
1515
string address = config["ServerAddress"] ?? throw new MissingConfigException("ServerAddress");
1616
logger.LogInformation($"I was about to use {address}");
1717
address = hostEnvironment.BaseAddress;
18-
logger.LogInformation("But instead I'll use {address}", address);
18+
logger.LogInformation("But instead I'll use {Address}", address);
1919
var channel = GrpcChannel.ForAddress(address, new GrpcChannelOptions
2020
{
2121
HttpHandler = new GrpcWebHandler(new HttpClientHandler())
@@ -116,13 +116,13 @@ public async Task RenamePlaylistAsync(string oldName, string newName)
116116
{
117117
try
118118
{
119-
logger.LogInformation("Calling RenamePlaylist gRPC method: {oldName} -> {newName}", oldName, newName);
119+
logger.LogInformation("Calling RenamePlaylist gRPC method: {OldName} -> {NewName}", oldName, newName);
120120
await client.RenamePlaylistAsync(new RenamePlaylistRequest { OldName = oldName, NewName = newName });
121-
logger.LogInformation("Successfully called RenamePlaylist gRPC method: {oldName} -> {newName}", oldName, newName);
121+
logger.LogInformation("Successfully called RenamePlaylist gRPC method: {OldName} -> {NewName}", oldName, newName);
122122
}
123123
catch (Exception ex)
124124
{
125-
logger.LogError(ex, "Error calling RenamePlaylist gRPC method: {oldName} -> {newName}", oldName, newName);
125+
logger.LogError(ex, "Error calling RenamePlaylist gRPC method: {OldName} -> {NewName}", oldName, newName);
126126
throw;
127127
}
128128
}
@@ -134,26 +134,26 @@ public async Task DeletePlaylistAsync(string playlistName)
134134

135135
public async Task ReorderPlaylistSongsAsync(string playlistName, List<string> songPaths)
136136
{
137-
logger.LogInformation("Calling ReorderPlaylistSongs gRPC method for playlist: {playlistName}", playlistName);
137+
logger.LogInformation("Calling ReorderPlaylistSongs gRPC method for playlist: {PlaylistName}", playlistName);
138138
await client.ReorderPlaylistSongsAsync(new ReorderPlaylistSongsRequest
139139
{
140140
PlaylistName = playlistName,
141141
SongPaths = { songPaths }
142142
});
143-
logger.LogInformation("Successfully called ReorderPlaylistSongs gRPC method for playlist: {playlistName}", playlistName);
143+
logger.LogInformation("Successfully called ReorderPlaylistSongs gRPC method for playlist: {PlaylistName}", playlistName);
144144
}
145145

146146
public async Task UpdateSongAsync(int songId, string name, string artist, string album)
147147
{
148-
logger.LogInformation("Calling UpdateSong gRPC method for song: {songId}", songId);
148+
logger.LogInformation("Calling UpdateSong gRPC method for song: {SongId}", songId);
149149
await client.UpdateSongAsync(new UpdateSongRequest
150150
{
151151
SongId = songId,
152152
Name = name,
153153
Artist = artist,
154154
Album = album
155155
});
156-
logger.LogInformation("Successfully called UpdateSong gRPC method for song: {songId}", songId);
156+
logger.LogInformation("Successfully called UpdateSong gRPC method for song: {SongId}", songId);
157157
}
158158

159159
readonly char[] separators = new[] { '/', '\\' };
@@ -175,12 +175,12 @@ public async Task<IEnumerable<string>> GetFolders()
175175

176176
if (directory == "c:")
177177
{
178-
logger.LogInformation("Directory: '{directory}' ({path})", directory, s.Path);
178+
logger.LogInformation("Directory: '{Directory}' ({Path})", directory, s.Path);
179179
}
180180

181181
if (!folders.Contains(directory))
182182
{
183-
logger.LogInformation("Directory: '{directory}' ({path})", directory, s.Path);
183+
logger.LogInformation("Directory: '{Directory}' ({Path})", directory, s.Path);
184184
folders.Add(directory);
185185
}
186186
}

HomeSpeaker.WebAssembly/Services/IAnchorService.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public async Task<AnchorDefinition> CreateAnchorDefinitionAsync(CreateAnchorDefi
9696
}
9797
catch (Exception ex)
9898
{
99-
logger.LogError(ex, "Failed to update anchor definition {id}", id);
99+
logger.LogError(ex, "Failed to update anchor definition {Id}", id);
100100
throw;
101101
}
102102
}
@@ -110,7 +110,7 @@ public async Task<bool> DeactivateAnchorDefinitionAsync(int id)
110110
}
111111
catch (Exception ex)
112112
{
113-
logger.LogError(ex, "Failed to deactivate anchor definition {id}", id);
113+
logger.LogError(ex, "Failed to deactivate anchor definition {Id}", id);
114114
return false;
115115
}
116116
}
@@ -127,7 +127,7 @@ public async Task<IEnumerable<UserAnchor>> GetUserAnchorsAsync(string userId)
127127
}
128128
catch (Exception ex)
129129
{
130-
logger.LogError(ex, "Failed to get user anchors for {userId}", userId);
130+
logger.LogError(ex, "Failed to get user anchors for {UserId}", userId);
131131
return [];
132132
}
133133
}
@@ -159,7 +159,7 @@ public async Task<bool> RemoveAnchorFromUserAsync(string userId, int anchorDefin
159159
}
160160
catch (Exception ex)
161161
{
162-
logger.LogError(ex, "Failed to remove anchor from user {userId}", userId);
162+
logger.LogError(ex, "Failed to remove anchor from user {UserId}", userId);
163163
return false;
164164
}
165165
}
@@ -176,7 +176,7 @@ public async Task<IEnumerable<DailyAnchor>> GetDailyAnchorsAsync(string userId,
176176
}
177177
catch (Exception ex)
178178
{
179-
logger.LogError(ex, "Failed to get daily anchors for {userId} on {date}", userId, date);
179+
logger.LogError(ex, "Failed to get daily anchors for {UserId} on {Date}", userId, date);
180180
return [];
181181
}
182182
}
@@ -203,7 +203,7 @@ public async Task<IEnumerable<DailyAnchor>> GetDailyAnchorsRangeAsync(string use
203203
}
204204
catch (Exception ex)
205205
{
206-
logger.LogError(ex, "Failed to get daily anchors range for {userId}", userId);
206+
logger.LogError(ex, "Failed to get daily anchors range for {UserId}", userId);
207207
return [];
208208
}
209209
}
@@ -217,7 +217,7 @@ public async Task CreateDailyAnchorsAsync(string userId, DateOnly date)
217217
}
218218
catch (Exception ex)
219219
{
220-
logger.LogError(ex, "Failed to create daily anchors for {userId} on {date}", userId, date);
220+
logger.LogError(ex, "Failed to create daily anchors for {UserId} on {Date}", userId, date);
221221
throw;
222222
}
223223
}

0 commit comments

Comments
 (0)