Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Commit

Permalink
refactor: remove debug logs (#1673)
Browse files Browse the repository at this point in the history
* refactor: remove debug print log and add correct log

* adjust log

* adjust import

Co-authored-by: Uzias Ferreira <[email protected]>
  • Loading branch information
uziasferreirazup and uziassantosferreira authored Jun 30, 2021
1 parent 3a613a4 commit a6af1bf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
13 changes: 4 additions & 9 deletions flutter/beagle/lib/bridge_impl/beagle_js_engine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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)');
};
}

Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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');
}
}

Expand Down
3 changes: 0 additions & 3 deletions flutter/beagle/lib/bridge_impl/renderer_js.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)");
}
Expand Down
5 changes: 3 additions & 2 deletions flutter/beagle_components/lib/beagle_lazy_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -84,11 +85,11 @@ class _BeagleLazyComponent extends State<BeagleLazyComponent>
.getRenderer()
.doFullRender(component, widget.beagleId, TreeUpdateMode.replace);
} else {
debugPrint(
beagleServiceLocator<BeagleLogger>().error(
'BeagleLazyComponent: connection error: ${result.status} ${result.body}');
}
} catch (err) {
debugPrint('BeagleLazyComponent: error: $err');
beagleServiceLocator<BeagleLogger>().error('BeagleLazyComponent: error: $err');
}
}

Expand Down

0 comments on commit a6af1bf

Please sign in to comment.