call method
Encodes given record
to formatted string.
If logger name isn't provided format callback receives empty string ''
instead of null
.
Each record
is passed to format (with optionally preformatted level
,
timestamp
and fields
using formatLevel, formatTimestamp,
formatFields
) and finally formatted string is appended with \r\n
.
Implementation
List<int> call(Record record) {
final message = format(
record.name ?? '',
formatTimestamp(record.timestamp),
formatLevel(record.level),
record.message,
_formatFields(record.fields),
);
if (message.isEmpty) {
return [];
}
return utf8.encode('$message$_eol');
}