fix(log): Logging System Improvements and Error Handling Enhancements (#994)
* fix: Added logging to exception handling Added detailed error logging to exception handling across multiple files, including exception information and stack traces, to facilitate troubleshooting. * refactor(logging): Standardize logging output methods Replace existing debugPrint and lprint with Loggers.app.warning to enhance logging consistency and maintainability. * refactor: Remove redundant debug log prints Clean up unnecessary log print statements in debug code * feat(i18n): Added internationalization support for the logging feature
This commit is contained in:
@@ -6,7 +6,6 @@ import 'package:dartssh2/dartssh2.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:dio/io.dart';
|
||||
import 'package:fl_lib/fl_lib.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:server_box/core/extension/context/locale.dart';
|
||||
@@ -108,7 +107,7 @@ class PveNotifier extends _$PveNotifier {
|
||||
final newUrl = Uri.parse(
|
||||
addr,
|
||||
).replace(host: 'localhost', port: _localPort).toString();
|
||||
debugPrint('Forwarding $newUrl to $addr');
|
||||
dprint('Forwarding $newUrl to $addr');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,11 +234,15 @@ class PveNotifier extends _$PveNotifier {
|
||||
Future<void> dispose() async {
|
||||
try {
|
||||
await _serverSocket.close();
|
||||
} catch (_) {}
|
||||
} catch (e, s) {
|
||||
Loggers.app.warning('Failed to close server socket', e, s);
|
||||
}
|
||||
for (final forward in _forwards) {
|
||||
try {
|
||||
forward.close();
|
||||
} catch (_) {}
|
||||
} catch (e, s) {
|
||||
Loggers.app.warning('Failed to close forward', e, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user