Setting Up ILogger inside a customer library

  • Thread starter Thread starter Gayan19911212
  • Start date Start date
G

Gayan19911212

Guest
Hi,

I have a utility library in .Net Core that needs to that uses ILogger interface to log into application insight. Originally it was built using TelemetryClient class but since the class is being deprecated only way I could use it is using ILogger.

The below is the constructor for my custom logger and this Logs class use ILogger for app. insight

internal Logs(ILogger logger)
{
iLogger = logger;
}

And the above constructor used in another class which would be called by a static method

public Operation()
{
log = new Logs();
}


Now I want to find a way to put the ILogger in to the constructor without bringing it from startup class. Could you suggest me a way I could build this dependency object and pass into Logs class?

Thanks in advance

Continue reading...
 
Back
Top