Log log file deletions
This commit is contained in:
parent
81c72488d2
commit
27510a2b97
1 changed files with 8 additions and 4 deletions
12
thirdparty/super_logging/lib/super_logging.dart
vendored
12
thirdparty/super_logging/lib/super_logging.dart
vendored
|
@ -187,7 +187,8 @@ class SuperLogging {
|
|||
$.info("setting sentry user ID to: $userID");
|
||||
}
|
||||
|
||||
static Future<void> _sendErrorToSentry(Object? error, StackTrace? stack) async {
|
||||
static Future<void> _sendErrorToSentry(
|
||||
Object? error, StackTrace? stack) async {
|
||||
try {
|
||||
await Sentry.captureException(
|
||||
error,
|
||||
|
@ -315,11 +316,14 @@ class SuperLogging {
|
|||
// sort files based on ascending order of date (older first)
|
||||
files.sort((a, b) => dates[a]!.compareTo(dates[b]!));
|
||||
|
||||
var extra = files.length - config.maxLogFiles;
|
||||
var toDelete = files.sublist(0, extra);
|
||||
final extra = files.length - config.maxLogFiles;
|
||||
final toDelete = files.sublist(0, extra);
|
||||
|
||||
for (var file in toDelete) {
|
||||
for (final file in toDelete) {
|
||||
try {
|
||||
$.fine(
|
||||
"deleting log file ${file.path}",
|
||||
);
|
||||
await file.delete();
|
||||
} catch (ignore) {}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue