Clean Architecture Demo
Toggle main menu visibility
Loading...
Searching...
No Matches
LoggingEmailService.cs
Go to the documentation of this file.
1
using
Microsoft.Extensions.Logging;
2
using
TaskManagement.Application.Ports
;
3
4
namespace
TaskManagement.Infrastructure.Email
;
5
20
public
sealed
class
LoggingEmailService
:
IEmailService
21
{
22
private
static
readonly Action<ILogger, Guid, Exception?> LogTaskCompletedEmail =
23
LoggerMessage.Define<Guid>(
24
LogLevel.Information,
25
new
EventId(2001, nameof(
SendTaskCompletedNotificationAsync
)),
26
"Email sent: task {TaskId} completed"
);
27
28
private
readonly ILogger<LoggingEmailService> _logger;
29
30
public
LoggingEmailService
(ILogger<LoggingEmailService> logger)
31
{
32
_logger = logger;
33
}
34
35
public
Task
SendTaskCompletedNotificationAsync
(Guid taskId, CancellationToken cancellationToken =
default
)
36
{
37
LogTaskCompletedEmail(_logger, taskId,
null
);
38
return
Task.CompletedTask;
39
}
40
}
TaskManagement.Infrastructure.Email.LoggingEmailService.LoggingEmailService
LoggingEmailService(ILogger< LoggingEmailService > logger)
Definition
LoggingEmailService.cs:30
TaskManagement.Infrastructure.Email.LoggingEmailService.SendTaskCompletedNotificationAsync
Task SendTaskCompletedNotificationAsync(Guid taskId, CancellationToken cancellationToken=default)
Definition
LoggingEmailService.cs:35
TaskManagement.Application.Ports.IEmailService
IEmailService es la abstracción para envío de notificaciones por correo electrónico.
Definition
IEmailService.cs:39
TaskManagement.Application.Ports
Definition
IDomainEventDispatcher.cs:3
TaskManagement.Infrastructure.Email
Definition
LoggingEmailService.cs:4
src
TaskManagement.Infrastructure
Email
LoggingEmailService.cs
Generated by
1.18.0