add some logging to the hub

This commit is contained in:
Ryan Peters 2024-12-16 15:36:47 -05:00
parent f69d19100d
commit d21a0e176a

View File

@ -8,10 +8,12 @@ namespace BinaryDad.Notes
public class NoteHub : Hub
{
private readonly INoteService noteService;
private readonly ILogger<NoteHub> logger;
public NoteHub(INoteService noteService)
public NoteHub(INoteService noteService, ILogger<NoteHub> logger)
{
this.noteService = noteService;
this.logger = logger;
}
public override Task OnConnectedAsync()
@ -25,6 +27,8 @@ namespace BinaryDad.Notes
public async Task SaveNote(string content, string noteName)
{
logger.LogInformation($"Saving note \"{noteName}\"");
noteService.SaveNote(content, noteName);
// find all other connections except for the current one