From a6af1bf6fa0b09d97124dedde31c53cb1af1c6b5 Mon Sep 17 00:00:00 2001 From: Uzias Ferreira <63263091+uziasferreirazup@users.noreply.github.com> Date: Wed, 30 Jun 2021 09:07:52 -0300 Subject: [PATCH] refactor: remove debug logs (#1673) * refactor: remove debug print log and add correct log * adjust log * adjust import Co-authored-by: Uzias Ferreira --- .../beagle/lib/bridge_impl/beagle_js_engine.dart | 13 ++++--------- flutter/beagle/lib/bridge_impl/renderer_js.dart | 3 --- .../lib/beagle_lazy_component.dart | 5 +++-- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/flutter/beagle/lib/bridge_impl/beagle_js_engine.dart b/flutter/beagle/lib/bridge_impl/beagle_js_engine.dart index d969f4c588..29ebf37a07 100644 --- a/flutter/beagle/lib/bridge_impl/beagle_js_engine.dart +++ b/flutter/beagle/lib/bridge_impl/beagle_js_engine.dart @@ -31,7 +31,6 @@ import 'package:beagle/model/beagle_ui_element.dart'; import 'package:beagle/model/response.dart'; import 'package:beagle/networking/beagle_network_options.dart'; import 'package:beagle/networking/beagle_request.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import 'package:flutter_js/flutter_js.dart'; import 'package:beagle/service_locator.dart'; @@ -104,8 +103,7 @@ class BeagleJSEngine { : "'$value', ${json.encode(argument)}"; final jsMethod = viewId == null ? 'call(' : "callViewFunction('$viewId', "; - final result = _jsRuntime.evaluate('global.beagle.$jsMethod$args)'); - debugPrint('dynamic function result: $result'); + _jsRuntime.evaluate('global.beagle.$jsMethod$args)'); }; } @@ -330,8 +328,7 @@ class BeagleJSEngine { final beagleJS = await rootBundle.loadString('packages/beagle/assets/js/beagle.js'); _jsRuntime.evaluate('var window = global = globalThis;'); - final bundleResult = await _jsRuntime.evaluateAsync(beagleJS); - debugPrint('Initialization result: $bundleResult'); + await _jsRuntime.evaluateAsync(beagleJS); } } @@ -403,14 +400,12 @@ class BeagleJSEngine { final args = argumentsMap == null ? "'$functionId'" : "'$functionId', ${json.encode(argumentsMap)}"; - final result = _jsRuntime.evaluate('global.beagle.call($args)'); - debugPrint('dynamic function result: $result'); + _jsRuntime.evaluate('global.beagle.call($args)'); } void respondHttpRequest(String id, Response response) { - final result = _jsRuntime.evaluate( + _jsRuntime.evaluate( 'global.beagle.httpClient.respond($id, ${response.toJson()})'); - debugPrint('httpClient.respond result: $result'); } } diff --git a/flutter/beagle/lib/bridge_impl/renderer_js.dart b/flutter/beagle/lib/bridge_impl/renderer_js.dart index 4439e35d51..247896780d 100644 --- a/flutter/beagle/lib/bridge_impl/renderer_js.dart +++ b/flutter/beagle/lib/bridge_impl/renderer_js.dart @@ -4,7 +4,6 @@ import 'package:beagle/bridge_impl/beagle_js_engine.dart'; import 'package:beagle/interface/renderer.dart'; import 'package:beagle/model/beagle_ui_element.dart'; import 'package:beagle/model/tree_update_mode.dart'; -import 'package:flutter/widgets.dart'; class RendererJS implements Renderer { RendererJS(this._beagleJSEngine, this._viewId); @@ -24,8 +23,6 @@ class RendererJS implements Renderer { final jsonTree = jsonEncode(tree.properties); final anchorArg = anchor == null ? '' : ", '$anchor'"; final modeArg = mode == null ? '' : ", '${_getJsTreeUpdateModeName(mode)}'"; - debugPrint( - "global.beagle.getViewById('$_viewId').getRenderer().$method($jsonTree$anchorArg$modeArg)"); _beagleJSEngine.evaluateJavascriptCode( "global.beagle.getViewById('$_viewId').getRenderer().$method($jsonTree$anchorArg$modeArg)"); } diff --git a/flutter/beagle_components/lib/beagle_lazy_component.dart b/flutter/beagle_components/lib/beagle_lazy_component.dart index 1a3e2581ad..8b42faf6b4 100644 --- a/flutter/beagle_components/lib/beagle_lazy_component.dart +++ b/flutter/beagle_components/lib/beagle_lazy_component.dart @@ -21,6 +21,7 @@ import 'package:beagle/beagle.dart'; import 'package:beagle/default/url_builder.dart'; import 'package:beagle/interface/beagle_service.dart'; import 'package:beagle/interface/beagle_view.dart'; +import 'package:beagle/logger/beagle_logger.dart'; import 'package:beagle/model/tree_update_mode.dart'; import 'package:beagle/service_locator.dart'; import 'package:beagle_components/after_layout.dart'; @@ -84,11 +85,11 @@ class _BeagleLazyComponent extends State .getRenderer() .doFullRender(component, widget.beagleId, TreeUpdateMode.replace); } else { - debugPrint( + beagleServiceLocator().error( 'BeagleLazyComponent: connection error: ${result.status} ${result.body}'); } } catch (err) { - debugPrint('BeagleLazyComponent: error: $err'); + beagleServiceLocator().error('BeagleLazyComponent: error: $err'); } }