Creating a .NET 5 logging class library
We will create a class library (DLL) that will support Application Insights logging and can be extended to support logging to other sources if needed. Perform the following steps for this:
- Create a new .NET 5 class library with the name
Logger
. - Install the
Microsoft.ApplicationInsights
package. - Create a new class called
ICustomLogger.cs
and add the following code:using System; using System.Collections.Generic; namespace Logger { public interface ICustomLogger { void Dependency(string dependencyTypeName, string dependencyName, string data, DateTimeOffset startTime, TimeSpan duration, bool success); void Error(string message, IDictionary<...