In this section, we will learn how to perform logging in the catalog web service. Let's start by choosing a layer where we'll execute the logging statements. Since the logic is encapsulated in the Catalog.Domain layer project, we will continue by implementing the logging part on the service classes defined in the project. First of all, let's start by defining a new logging class, which contains the corresponding event id for each operation:
namespace Catalog.Domain.Logging
{
public class Events
{
public const int Get = 1000;
public const int GetById = 1001;
public const int Add = 1002;
public const int Edit = 1003;
public const int Delete = 1004;
}
}
Once we have established a corresponding log event id for each activity, we need to define the logging messages that will be used by the ILogger...