Код: Выделить всё
public class FooController {
[HttpPost]
public Foo CreateFoo(FooDto fooDto) {
_logger.Debug("Some logging in the controller");
var foo = _mapper.Map(fooDto);
_fooService.CreateFoo(foo);
}
}
Код: Выделить всё
public class FooService {
public void CreateFoo(IFoo foo) {
_logger.Debug("Some logging in the service");
_fooRepository.Create(foo);
}
}
Код: Выделить всё
public class FooRepository {
public void CreateFoo(IFoo foo) {
_logger.Debug("Some logging in the repository");
}
}
Например, что-то вроде этого:
Код: Выделить всё
2023-08-07 08:40:06.3280 DEBUG REQUEST-ID FooController Some logging in the controller
2023-08-07 08:40:06.3281 DEBUG REQUEST-ID FooService Some logging in the service
2023-08-07 08:40:06.3282 DEBUG REQUEST-ID FooRepository Some logging in the repository
Подробнее здесь: https://stackoverflow.com/questions/768 ... request-id
Мобильная версия