Closed kapilbhavsar closed 2 years ago
Hi,
I assume you're talking about injecting ILogger into a plugin or a service inside a plugin ? I would advise not to use ILogger, but to provide an abstraction that is defined in your Contract
Something like:
public interface IPluginLogger
{
void LogInformation(string message);
void LogError(string message);
}
In the Host you must provide the implementation like an Adapter pattern, meaning you wrap the ILogger inside the IPluginLogger (or MyPluginLogger)
Just remember to use ILogger instead of ILogger
There's an example of this in the docs at Host Services https://merken.github.io/Prise/#/?id=🎩-host-services
How can I inject type ILogger<MyService> in MyService class