generateTextMessage method
Internal method that generates a complete message about the event
See examples:
TalkerLog
-> TalkerLog.generateTextMessage
TalkerException
-> TalkerException.generateTextMessage
TalkerError
-> TalkerError.generateTextMessage
Implementation
@override
String generateTextMessage({
TimeFormat timeFormat = TimeFormat.timeAndSeconds,
}) {
var msg = '[$title] [${requestOptions.method}] $message';
final data = requestOptions.data;
final headers = requestOptions.headers;
try {
if (settings.printRequestData && data != null) {
final prettyData = encoder.convert(data);
msg += '\nData: $prettyData';
}
if (settings.printRequestHeaders && headers.isNotEmpty) {
final prettyHeaders = encoder.convert(headers);
msg += '\nHeaders: $prettyHeaders';
}
} catch (_) {
// TODO: add handling can`t convert
}
return msg;
}