refactor
This commit is contained in:
parent
7b147569e0
commit
d32207fbf7
6 changed files with 30 additions and 51 deletions
|
|
@ -30,7 +30,8 @@ public class SmtpServer<TSession>(IServiceScopeFactory scopeFactory, ILogger<Smt
|
|||
IsRunning = true;
|
||||
|
||||
// log
|
||||
_logger.LogInformation("SMTP listening on {HOST}:{PORT}", config.Host, config.Port);
|
||||
if (_logger.IsEnabled(LogLevel.Information))
|
||||
_logger.LogInformation("SMTP listening on {HOST}:{PORT}", config.Host, config.Port);
|
||||
|
||||
// handler loop
|
||||
while (!cancellationToken.IsCancellationRequested)
|
||||
|
|
@ -46,7 +47,8 @@ public class SmtpServer<TSession>(IServiceScopeFactory scopeFactory, ILogger<Smt
|
|||
catch (OperationCanceledException) { }
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex.ToString());
|
||||
if (_logger.IsEnabled(LogLevel.Error))
|
||||
_logger.LogError("ERROR: [{ERR}]", ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue