append method
Appending the given logRecord
.
Implementation
@override
void append(LogRecord logRecord) async {
logRecord.loggerName ??= getType();
final message = Message()
..from = Address(fromMail!, fromName)
..recipients.addAll(to)
..subject =
'Logger ${logRecord.level} at ${logRecord.getFormattedTime()}';
if (html!) {
message.html = LogRecordFormatter.formatEmail(template, logRecord,
dateFormat: dateFormat);
} else {
message.text = LogRecordFormatter.formatEmail(template, logRecord,
dateFormat: dateFormat);
}
if (IterableUtils.isNotNullOrEmpty(toCC)) {
message.ccRecipients.addAll(toCC!);
}
if (IterableUtils.isNotNullOrEmpty(toBCC)) {
message.bccRecipients.addAll(toBCC!);
}
try {
await _connection.send(message);
} catch (e) {
print(e);
return;
}
}