Skip to content

Commit

Permalink
[settings] improve logger output for errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dreautall committed Mar 20, 2024
1 parent 24a1682 commit 3d3ab6d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,15 @@ class DebugLogger {
if (_logPath?.isEmpty ?? true) {
return;
}
String message = record.message;
if (record.error != null) {
message += "\nERROR MESSAGE: ${record.error}";
}
if (record.stackTrace != null) {
message += "\nSTACKTRACE:\n${record.stackTrace}\n\n";
}
File(_logPath!).writeAsStringSync(
"${record.time}: [${record.loggerName} - ${record.level.name}] ${record.message}\n",
"${record.time}: [${record.loggerName} - ${record.level.name}] $message\n",
mode: FileMode.append,
flush: true,
);
Expand Down

0 comments on commit 3d3ab6d

Please sign in to comment.