I found out how to do this, it turns out its pretty simple I just didn't think to look outside the ILogger
code.
In your ILoggerProvider
the ILogger CreateLogger(string categoryName)
has the category name from ILogger<TCategoryName>
. Just need to pass that to the constructor of your ILogger
.
e.g.
public ILogger CreateLogger(string categoryName) => new DbLogger(this, categoryName, TimeProvider.System);