Skip to content

Commit

Permalink
feat: add stack traces to logs page
Browse files Browse the repository at this point in the history
  • Loading branch information
adil192 committed Oct 1, 2024
1 parent 3e3aab3 commit 88bed01
Show file tree
Hide file tree
Showing 7 changed files with 210 additions and 22 deletions.
1 change: 1 addition & 0 deletions assets/images/undraw_detailed_analysis_re_tk6j.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions lib/components/theming/font_fallbacks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ extension FallbackTextStyle on TextStyle {
'Dekko',
];

TextStyle withFallbacks() => copyWith(
TextStyle withFallbacks([
List<String> fallbacks = sansSerifFallbacks,
]) =>
copyWith(
fontFamilyFallback: fontFamilyFallback == null
? sansSerifFallbacks
: [...fontFamilyFallback!, ...sansSerifFallbacks],
? fallbacks
: [...fontFamilyFallback!, ...fallbacks],
);
}
30 changes: 30 additions & 0 deletions lib/i18n/_missing_translations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ ar:
logs: Logs
viewLogs: View logs
debuggingInfo: Logs contain information useful for debugging and development
noLogs: "No logs here!"
logsAreTemporary: Logs are only kept until you close the app
login:
notYou(rich)(OUTDATED): "Not you? ${undoLogin(Choose another account)}."
status:
Expand Down Expand Up @@ -143,11 +145,15 @@ cs:
logs: Logs
viewLogs: View logs
debuggingInfo: Logs contain information useful for debugging and development
noLogs: "No logs here!"
logsAreTemporary: Logs are only kept until you close the app
de:
logs:
logs: Logs
viewLogs: View logs
debuggingInfo: Logs contain information useful for debugging and development
noLogs: "No logs here!"
logsAreTemporary: Logs are only kept until you close the app
es:
common:
done(OUTDATED): Done
Expand Down Expand Up @@ -180,6 +186,8 @@ es:
logs: Logs
viewLogs: View logs
debuggingInfo: Logs contain information useful for debugging and development
noLogs: "No logs here!"
logsAreTemporary: Logs are only kept until you close the app
login:
notYou(rich)(OUTDATED): "Not you? ${undoLogin(Choose another account)}."
status:
Expand Down Expand Up @@ -259,6 +267,8 @@ fa:
logs: Logs
viewLogs: View logs
debuggingInfo: Logs contain information useful for debugging and development
noLogs: "No logs here!"
logsAreTemporary: Logs are only kept until you close the app
login:
notYou(rich)(OUTDATED): "Not you? ${undoLogin(Choose another account)}."
status:
Expand Down Expand Up @@ -332,6 +342,8 @@ fr:
logs: Logs
viewLogs: View logs
debuggingInfo: Logs contain information useful for debugging and development
noLogs: "No logs here!"
logsAreTemporary: Logs are only kept until you close the app
login:
notYou(rich)(OUTDATED): "Not you? ${undoLogin(Choose another account)}."
status:
Expand Down Expand Up @@ -422,6 +434,8 @@ he:
logs: Logs
viewLogs: View logs
debuggingInfo: Logs contain information useful for debugging and development
noLogs: "No logs here!"
logsAreTemporary: Logs are only kept until you close the app
login:
notYou(rich)(OUTDATED): "Not you? ${undoLogin(Choose another account)}."
status:
Expand Down Expand Up @@ -582,6 +596,8 @@ hu:
logs: Logs
viewLogs: View logs
debuggingInfo: Logs contain information useful for debugging and development
noLogs: "No logs here!"
logsAreTemporary: Logs are only kept until you close the app
login:
notYou(rich)(OUTDATED): "Not you? ${undoLogin(Choose another account)}."
status:
Expand Down Expand Up @@ -705,6 +721,8 @@ it:
logs: Logs
viewLogs: View logs
debuggingInfo: Logs contain information useful for debugging and development
noLogs: "No logs here!"
logsAreTemporary: Logs are only kept until you close the app
ja:
common:
done(OUTDATED): Done
Expand Down Expand Up @@ -776,6 +794,8 @@ ja:
logs: Logs
viewLogs: View logs
debuggingInfo: Logs contain information useful for debugging and development
noLogs: "No logs here!"
logsAreTemporary: Logs are only kept until you close the app
login:
notYou(rich)(OUTDATED): "Not you? ${undoLogin(Choose another account)}."
status:
Expand Down Expand Up @@ -877,6 +897,8 @@ pt-BR:
logs: Logs
viewLogs: View logs
debuggingInfo: Logs contain information useful for debugging and development
noLogs: "No logs here!"
logsAreTemporary: Logs are only kept until you close the app
login:
notYou(rich)(OUTDATED): "Not you? ${undoLogin(Choose another account)}."
status:
Expand Down Expand Up @@ -940,18 +962,26 @@ ru:
logs: Logs
viewLogs: View logs
debuggingInfo: Logs contain information useful for debugging and development
noLogs: "No logs here!"
logsAreTemporary: Logs are only kept until you close the app
tr:
logs:
logs: Logs
viewLogs: View logs
debuggingInfo: Logs contain information useful for debugging and development
noLogs: "No logs here!"
logsAreTemporary: Logs are only kept until you close the app
zh-Hans-CN:
logs:
logs: Logs
viewLogs: View logs
debuggingInfo: Logs contain information useful for debugging and development
noLogs: "No logs here!"
logsAreTemporary: Logs are only kept until you close the app
zh-Hant-TW:
logs:
logs: Logs
viewLogs: View logs
debuggingInfo: Logs contain information useful for debugging and development
noLogs: "No logs here!"
logsAreTemporary: Logs are only kept until you close the app
2 changes: 2 additions & 0 deletions lib/i18n/strings.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ class _StringsLogsEn {
String get logs => 'Logs';
String get viewLogs => 'View logs';
String get debuggingInfo => 'Logs contain information useful for debugging and development';
String get noLogs => 'No logs here!';
String get logsAreTemporary => 'Logs are only kept until you close the app';
}

// Path: login
Expand Down
2 changes: 2 additions & 0 deletions lib/i18n/strings.i18n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ logs:
logs: Logs
viewLogs: View logs
debuggingInfo: Logs contain information useful for debugging and development
noLogs: No logs here!
logsAreTemporary: Logs are only kept until you close the app
login:
title: Login
form:
Expand Down
25 changes: 14 additions & 11 deletions lib/main_common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,20 @@ Future<void> main(
print('${record.level.name}: ${record.loggerName}: ${record.message}');
});

final errorLogger = Logger('ErrorLogger');
FlutterError.onError = (details) {
errorLogger.severe(
details.exceptionAsString(), details.exception, details.stack);
FlutterError.presentError(details);
};
PlatformDispatcher.instance.onError = (error, stackTrace) {
errorLogger.severe(error, stackTrace);
// Returns false in debug mode so the error is printed to stderr
return !kDebugMode;
};
// For some reason, logging errors breaks hot reload while debugging.
if (!kDebugMode) {
final errorLogger = Logger('ErrorLogger');
FlutterError.onError = (details) {
errorLogger.severe(
details.exceptionAsString(), details.exception, details.stack);
FlutterError.presentError(details);
};
PlatformDispatcher.instance.onError = (error, stackTrace) {
errorLogger.severe(error, stackTrace);
// Returns false in debug mode so the error is printed to stderr
return !kDebugMode;
};
}

StrokeOptionsExtension.setDefaults();
Prefs.init();
Expand Down
Loading

0 comments on commit 88bed01

Please sign in to comment.