From 3d3ab6d8a9baf1cd9c28704784f5ef7e06bb31d5 Mon Sep 17 00:00:00 2001 From: dreautall <109872040+dreautall@users.noreply.github.com> Date: Wed, 20 Mar 2024 19:56:00 +0000 Subject: [PATCH] [settings] improve logger output for errors --- lib/settings.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/settings.dart b/lib/settings.dart index 039f4093..a1e5fc54 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -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, );