Bläddra i källkod

Use stdout/-err for all messages in HTML5 platform

Leon Krause 6 år sedan
förälder
incheckning
76522624cb

+ 1 - 1
platform/javascript/audio_driver_javascript.cpp

@@ -209,7 +209,7 @@ Error AudioDriverJavaScript::capture_start() {
 		}
 
 		function gotMediaInputError(e) {
-			console.log(e);
+			out(e);
 		}
 
 		if (navigator.mediaDevices.getUserMedia) {

+ 3 - 3
platform/javascript/http_request.js

@@ -82,7 +82,7 @@ var GodotHTTPRequest = {
 
 	godot_xhr_send_string: function(xhrId, strPtr) {
 		if (!strPtr) {
-			console.warn("Failed to send string per XHR: null pointer");
+			err("Failed to send string per XHR: null pointer");
 			return;
 		}
 		GodotHTTPRequest.requests[xhrId].send(UTF8ToString(strPtr));
@@ -90,11 +90,11 @@ var GodotHTTPRequest = {
 
 	godot_xhr_send_data: function(xhrId, ptr, len) {
 		if (!ptr) {
-			console.warn("Failed to send data per XHR: null pointer");
+			err("Failed to send data per XHR: null pointer");
 			return;
 		}
 		if (len < 0) {
-			console.warn("Failed to send data per XHR: buffer length less than 0");
+			err("Failed to send data per XHR: buffer length less than 0");
 			return;
 		}
 		GodotHTTPRequest.requests[xhrId].send(HEAPU8.subarray(ptr, ptr + len));

+ 2 - 2
platform/javascript/javascript_eval.cpp

@@ -69,7 +69,7 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) {
 				eval_ret = eval(UTF8ToString(CODE));
 			}
 		} catch (e) {
-			console.warn(e);
+			err(e);
 			eval_ret = null;
 		}
 
@@ -97,7 +97,7 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) {
 					if (array_ptr!==0) {
 						_free(array_ptr)
 					}
-					console.warn(e);
+					err(e);
 					// fall through
 				}
 				break;

+ 2 - 2
platform/javascript/os_javascript.cpp

@@ -986,8 +986,8 @@ bool OS_JavaScript::main_loop_iterate() {
 		if (sync_wait_time < 0) {
 			/* clang-format off */
 			EM_ASM(
-				FS.syncfs(function(err) {
-					if (err) { console.warn('Failed to save IDB file system: ' + err.message); }
+				FS.syncfs(function(error) {
+					if (error) { err('Failed to save IDB file system: ' + error.message); }
 				});
 			);
 			/* clang-format on */