Jorge

added name GETX to developer.log method, avoid passing name GETX in every usage of the log method

import 'package:flutter/foundation.dart';
import 'package:get/instance_manager.dart';
import 'dart:developer' as developer;
typedef LogWriterCallback = void Function(String text, {@required String name, bool isError});
typedef LogWriterCallback = void Function(String text, {bool isError});
void defaultLogWriterCallback(String value, {@required String name, bool isError = false}) {
if (isError || GetConfig.isLogEnable) developer.log(value, name: name);
void defaultLogWriterCallback(String value, {bool isError = false}) {
if (isError || GetConfig.isLogEnable) developer.log(value, name: '[GETX]');
}
... ...
... ... @@ -128,7 +128,7 @@ class GetInstance {
if (i is DisposableInterface) {
i.onStart();
GetConfig.log('$key has been initialized', name: '[GETX]');
GetConfig.log('$key has been initialized');
}
}
... ... @@ -173,7 +173,7 @@ class GetInstance {
if (!_factory.containsKey(key))
throw " $S not found. You need call put<$S>($S()) before";
GetConfig.log('$S instance was created at that time', name: '[GETX]');
GetConfig.log('$S instance was created at that time');
S _value = put<S>(_factory[key].builder() as S);
initDependencies<S>(name: tag);
... ... @@ -217,8 +217,7 @@ class GetInstance {
return queue.add<bool>(() async {
if (!_singl.containsKey(newKey)) {
GetConfig.log('Instance $newKey already been removed.', name: '[GETX]',
isError: true);
GetConfig.log('Instance $newKey already been removed.', isError: true);
return false;
}
... ... @@ -226,7 +225,6 @@ class GetInstance {
if (builder.permanent && !force) {
GetConfig.log(
'[$newKey] has been marked as permanent, SmartManagement is not authorized to delete it.',
name: '[GETX]',
isError: true);
return false;
}
... ... @@ -237,14 +235,14 @@ class GetInstance {
}
if (i is DisposableInterface) {
await i.onClose();
GetConfig.log('onClose of $newKey called', name: '[GETX]');
GetConfig.log('onClose of $newKey called');
}
_singl.removeWhere((oldKey, value) => (oldKey == newKey));
if (_singl.containsKey(newKey)) {
GetConfig.log('error on remove object $newKey', name: '[GETX]', isError: true);
GetConfig.log('error on remove object $newKey', isError: true);
} else {
GetConfig.log('$newKey deleted from memory', name: '[GETX]');
GetConfig.log('$newKey deleted from memory');
}
// _routesKey?.remove(key);
return true;
... ...
... ... @@ -72,13 +72,13 @@ class GetObserver extends NavigatorObserver {
String routeName = name(route);
if (isSnackbar) {
GetConfig.log("OPEN SNACKBAR $routeName", name: '[GETX]');
GetConfig.log("OPEN SNACKBAR $routeName");
} else if (isBottomSheet) {
GetConfig.log("OPEN $routeName", name: '[GETX]');
GetConfig.log("OPEN $routeName");
} else if (isDialog) {
GetConfig.log("OPEN $routeName", name: '[GETX]');
GetConfig.log("OPEN $routeName");
} else if (isGetPageRoute) {
GetConfig.log("GOING TO ROUTE $routeName", name: '[GETX]');
GetConfig.log("GOING TO ROUTE $routeName");
}
GetConfig.currentRoute = routeName;
... ... @@ -107,13 +107,13 @@ class GetObserver extends NavigatorObserver {
String routeName = name(route);
if (isSnackbar) {
GetConfig.log("CLOSE SNACKBAR $routeName", name: '[GETX]');
GetConfig.log("CLOSE SNACKBAR $routeName");
} else if (isBottomSheet) {
GetConfig.log("CLOSE $routeName", name: '[GETX]');
GetConfig.log("CLOSE $routeName");
} else if (isDialog) {
GetConfig.log("CLOSE $routeName", name: '[GETX]');
GetConfig.log("CLOSE $routeName");
} else if (isGetPageRoute) {
GetConfig.log("CLOSE TO ROUTE $routeName", name: '[GETX]');
GetConfig.log("CLOSE TO ROUTE $routeName");
}
GetConfig.currentRoute = routeName;
... ... @@ -136,8 +136,8 @@ class GetObserver extends NavigatorObserver {
void didReplace({Route newRoute, Route oldRoute}) {
super.didReplace(newRoute: newRoute, oldRoute: oldRoute);
GetConfig.log("REPLACE ROUTE ${oldRoute?.settings?.name}", name: '[GETX]');
GetConfig.log("NEW ROUTE ${newRoute?.settings?.name}", name: '[GETX]');
GetConfig.log("REPLACE ROUTE ${oldRoute?.settings?.name}");
GetConfig.log("NEW ROUTE ${newRoute?.settings?.name}");
GetConfig.currentRoute = name(newRoute);
... ... @@ -158,7 +158,7 @@ class GetObserver extends NavigatorObserver {
@override
void didRemove(Route route, Route previousRoute) {
super.didRemove(route, previousRoute);
GetConfig.log("REMOVING ROUTE ${route?.settings?.name}", name: '[GETX]');
GetConfig.log("REMOVING ROUTE ${route?.settings?.name}");
_routeSend.update((value) {
value.route = previousRoute;
... ...
... ... @@ -100,7 +100,7 @@ class Worker {
final String type;
void _message() {
GetConfig.log('Worker $type disposed', name: '[Getx]');
GetConfig.log('Worker $type disposed');
}
void dispose() {
... ...