Throw missing dependency exception if call "ctx.GetLogger()" without passing category name
Closed this issue · 4 comments
hotyes commented
let handler (ctx: HttpContext) =
task {
let logger = ctx.GetLogger()
// ...
// other code
}
Oxpecker.MissingDependencyException: Could not retrieve object of type 'ILogger' from ASP.NET Core's dependency container.
at Oxpecker.HttpContextExtensions.GetService[T](HttpContext ctx)
Lanayx commented
@hotyes Have you registered your logger in DI? GetLogger works just fine in Basic app
hotyes commented
No, I thought it was registered by default ..
Lanayx commented
Good catch, added default registration in https://www.nuget.org/packages/Oxpecker/0.9.2
hotyes commented
Confirmed it is working now in v0.9.2