Nice article, thanks. I downloaded the repo & noticed that the _logger.LogInformation of Woker. StartAsync isn't writing to the console. Question for you, how would you access the logger in MyService.PerformLongTaskAsync?
Thanks a lot, I'm happy you did find this helpful.
Nice spot, there was a mistake into the csproj and the Serilog config was not loaded in the 'Development' configuration. I've updated the repo with this change.
You can access the logger in MyService class injecting the ILogger class through the constructor:
publicclassMyService:IMyService{privatereadonlyILogger<MyService>_logger;publicMyService(ILogger<MyService>logger){_logger=logger;}publicasyncTaskPerformLongTaskAsync(){_logger?.LogInformation("Whatever you want");awaitTask.Delay(5000);}}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice article, thanks. I downloaded the repo & noticed that the _logger.LogInformation of Woker. StartAsync isn't writing to the console. Question for you, how would you access the logger in MyService.PerformLongTaskAsync?
Thanks a lot, I'm happy you did find this helpful.
Nice spot, there was a mistake into the csproj and the Serilog config was not loaded in the 'Development' configuration. I've updated the repo with this change.
You can access the logger in MyService class injecting the ILogger class through the constructor: