getCSVString method
Converts the log message to a CSV row string.
Returns: A CSV-formatted string with fields separated by commas.
Implementation
String getCSVString() {
final List<String> row = [
(timeStamp ?? DateTime.now()).toIso8601String(),
level.toString().split('.').last,
'"${category.replaceAll('"', '""')}"',
'"${message.replaceAll('"', '""')}"',
'"${environment.replaceAll('"', '""')}"',
timeLine.toString(),
];
return '${row.join(',')}\n';
}