Jorge

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

1 1
2 -import 'package:flutter/foundation.dart';  
3 import 'package:get/instance_manager.dart'; 2 import 'package:get/instance_manager.dart';
4 import 'dart:developer' as developer; 3 import 'dart:developer' as developer;
5 4
6 -typedef LogWriterCallback = void Function(String text, {@required String name, bool isError}); 5 +typedef LogWriterCallback = void Function(String text, {bool isError});
7 6
8 -void defaultLogWriterCallback(String value, {@required String name, bool isError = false}) {  
9 - if (isError || GetConfig.isLogEnable) developer.log(value, name: name); 7 +void defaultLogWriterCallback(String value, {bool isError = false}) {
  8 + if (isError || GetConfig.isLogEnable) developer.log(value, name: '[GETX]');
10 } 9 }
@@ -128,7 +128,7 @@ class GetInstance { @@ -128,7 +128,7 @@ class GetInstance {
128 128
129 if (i is DisposableInterface) { 129 if (i is DisposableInterface) {
130 i.onStart(); 130 i.onStart();
131 - GetConfig.log('$key has been initialized', name: '[GETX]'); 131 + GetConfig.log('$key has been initialized');
132 } 132 }
133 } 133 }
134 134
@@ -173,7 +173,7 @@ class GetInstance { @@ -173,7 +173,7 @@ class GetInstance {
173 if (!_factory.containsKey(key)) 173 if (!_factory.containsKey(key))
174 throw " $S not found. You need call put<$S>($S()) before"; 174 throw " $S not found. You need call put<$S>($S()) before";
175 175
176 - GetConfig.log('$S instance was created at that time', name: '[GETX]'); 176 + GetConfig.log('$S instance was created at that time');
177 S _value = put<S>(_factory[key].builder() as S); 177 S _value = put<S>(_factory[key].builder() as S);
178 178
179 initDependencies<S>(name: tag); 179 initDependencies<S>(name: tag);
@@ -217,8 +217,7 @@ class GetInstance { @@ -217,8 +217,7 @@ class GetInstance {
217 217
218 return queue.add<bool>(() async { 218 return queue.add<bool>(() async {
219 if (!_singl.containsKey(newKey)) { 219 if (!_singl.containsKey(newKey)) {
220 - GetConfig.log('Instance $newKey already been removed.', name: '[GETX]',  
221 - isError: true); 220 + GetConfig.log('Instance $newKey already been removed.', isError: true);
222 return false; 221 return false;
223 } 222 }
224 223
@@ -226,7 +225,6 @@ class GetInstance { @@ -226,7 +225,6 @@ class GetInstance {
226 if (builder.permanent && !force) { 225 if (builder.permanent && !force) {
227 GetConfig.log( 226 GetConfig.log(
228 '[$newKey] has been marked as permanent, SmartManagement is not authorized to delete it.', 227 '[$newKey] has been marked as permanent, SmartManagement is not authorized to delete it.',
229 - name: '[GETX]',  
230 isError: true); 228 isError: true);
231 return false; 229 return false;
232 } 230 }
@@ -237,14 +235,14 @@ class GetInstance { @@ -237,14 +235,14 @@ class GetInstance {
237 } 235 }
238 if (i is DisposableInterface) { 236 if (i is DisposableInterface) {
239 await i.onClose(); 237 await i.onClose();
240 - GetConfig.log('onClose of $newKey called', name: '[GETX]'); 238 + GetConfig.log('onClose of $newKey called');
241 } 239 }
242 240
243 _singl.removeWhere((oldKey, value) => (oldKey == newKey)); 241 _singl.removeWhere((oldKey, value) => (oldKey == newKey));
244 if (_singl.containsKey(newKey)) { 242 if (_singl.containsKey(newKey)) {
245 - GetConfig.log('error on remove object $newKey', name: '[GETX]', isError: true); 243 + GetConfig.log('error on remove object $newKey', isError: true);
246 } else { 244 } else {
247 - GetConfig.log('$newKey deleted from memory', name: '[GETX]'); 245 + GetConfig.log('$newKey deleted from memory');
248 } 246 }
249 // _routesKey?.remove(key); 247 // _routesKey?.remove(key);
250 return true; 248 return true;
@@ -72,13 +72,13 @@ class GetObserver extends NavigatorObserver { @@ -72,13 +72,13 @@ class GetObserver extends NavigatorObserver {
72 String routeName = name(route); 72 String routeName = name(route);
73 73
74 if (isSnackbar) { 74 if (isSnackbar) {
75 - GetConfig.log("OPEN SNACKBAR $routeName", name: '[GETX]'); 75 + GetConfig.log("OPEN SNACKBAR $routeName");
76 } else if (isBottomSheet) { 76 } else if (isBottomSheet) {
77 - GetConfig.log("OPEN $routeName", name: '[GETX]'); 77 + GetConfig.log("OPEN $routeName");
78 } else if (isDialog) { 78 } else if (isDialog) {
79 - GetConfig.log("OPEN $routeName", name: '[GETX]'); 79 + GetConfig.log("OPEN $routeName");
80 } else if (isGetPageRoute) { 80 } else if (isGetPageRoute) {
81 - GetConfig.log("GOING TO ROUTE $routeName", name: '[GETX]'); 81 + GetConfig.log("GOING TO ROUTE $routeName");
82 } 82 }
83 GetConfig.currentRoute = routeName; 83 GetConfig.currentRoute = routeName;
84 84
@@ -107,13 +107,13 @@ class GetObserver extends NavigatorObserver { @@ -107,13 +107,13 @@ class GetObserver extends NavigatorObserver {
107 String routeName = name(route); 107 String routeName = name(route);
108 108
109 if (isSnackbar) { 109 if (isSnackbar) {
110 - GetConfig.log("CLOSE SNACKBAR $routeName", name: '[GETX]'); 110 + GetConfig.log("CLOSE SNACKBAR $routeName");
111 } else if (isBottomSheet) { 111 } else if (isBottomSheet) {
112 - GetConfig.log("CLOSE $routeName", name: '[GETX]'); 112 + GetConfig.log("CLOSE $routeName");
113 } else if (isDialog) { 113 } else if (isDialog) {
114 - GetConfig.log("CLOSE $routeName", name: '[GETX]'); 114 + GetConfig.log("CLOSE $routeName");
115 } else if (isGetPageRoute) { 115 } else if (isGetPageRoute) {
116 - GetConfig.log("CLOSE TO ROUTE $routeName", name: '[GETX]'); 116 + GetConfig.log("CLOSE TO ROUTE $routeName");
117 } 117 }
118 GetConfig.currentRoute = routeName; 118 GetConfig.currentRoute = routeName;
119 119
@@ -136,8 +136,8 @@ class GetObserver extends NavigatorObserver { @@ -136,8 +136,8 @@ class GetObserver extends NavigatorObserver {
136 void didReplace({Route newRoute, Route oldRoute}) { 136 void didReplace({Route newRoute, Route oldRoute}) {
137 super.didReplace(newRoute: newRoute, oldRoute: oldRoute); 137 super.didReplace(newRoute: newRoute, oldRoute: oldRoute);
138 138
139 - GetConfig.log("REPLACE ROUTE ${oldRoute?.settings?.name}", name: '[GETX]');  
140 - GetConfig.log("NEW ROUTE ${newRoute?.settings?.name}", name: '[GETX]'); 139 + GetConfig.log("REPLACE ROUTE ${oldRoute?.settings?.name}");
  140 + GetConfig.log("NEW ROUTE ${newRoute?.settings?.name}");
141 141
142 GetConfig.currentRoute = name(newRoute); 142 GetConfig.currentRoute = name(newRoute);
143 143
@@ -158,7 +158,7 @@ class GetObserver extends NavigatorObserver { @@ -158,7 +158,7 @@ class GetObserver extends NavigatorObserver {
158 @override 158 @override
159 void didRemove(Route route, Route previousRoute) { 159 void didRemove(Route route, Route previousRoute) {
160 super.didRemove(route, previousRoute); 160 super.didRemove(route, previousRoute);
161 - GetConfig.log("REMOVING ROUTE ${route?.settings?.name}", name: '[GETX]'); 161 + GetConfig.log("REMOVING ROUTE ${route?.settings?.name}");
162 162
163 _routeSend.update((value) { 163 _routeSend.update((value) {
164 value.route = previousRoute; 164 value.route = previousRoute;
@@ -100,7 +100,7 @@ class Worker { @@ -100,7 +100,7 @@ class Worker {
100 final String type; 100 final String type;
101 101
102 void _message() { 102 void _message() {
103 - GetConfig.log('Worker $type disposed', name: '[Getx]'); 103 + GetConfig.log('Worker $type disposed');
104 } 104 }
105 105
106 void dispose() { 106 void dispose() {