timeLogDecorator function
A log decorator that add time of the record behind the log-message
Implementation
LogDecorator timeLogDecorator({
String separator = ' ',
Adapter<String, String>? wrapper,
Adapter<DateTime, String> formatter = _defaultFormatter,
}) {
return (message, record) {
final buffer = StringBuffer();
final formattedTime = formatter(record.time);
buffer
..write(wrapper?.call(formattedTime) ?? formattedTime)
..write(separator)
..write(message);
return buffer.toString();
};
}