2024-06-25 21:54:56 +00:00
|
|
|
import 'dart:developer' as developer;
|
|
|
|
|
|
|
|
import 'package:selfprivacy/config/config.dart';
|
|
|
|
|
|
|
|
class AppLogger {
|
|
|
|
const AppLogger({required this.name});
|
2024-06-30 14:49:07 +00:00
|
|
|
|
2024-06-25 21:54:56 +00:00
|
|
|
final String name;
|
|
|
|
|
|
|
|
// TODO: research other possible options, which could support both
|
|
|
|
// throttling and output formatting
|
|
|
|
void log(
|
|
|
|
final String message, {
|
|
|
|
final Object? error,
|
|
|
|
final StackTrace? stackTrace,
|
|
|
|
}) {
|
|
|
|
if (config.shouldDebugPrint) {
|
2024-06-30 14:49:07 +00:00
|
|
|
// TODO: could probably add UI logging for console_page
|
2024-06-25 21:54:56 +00:00
|
|
|
developer.log(
|
|
|
|
message,
|
|
|
|
error: error,
|
|
|
|
stackTrace: stackTrace,
|
|
|
|
time: DateTime.now(),
|
|
|
|
name: name,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|