@@ -91,18 +91,18 @@ bool IsESModule(const std::string& path) {
9191 .ToLocal (&script) &&
9292 tc.HasCaught ()) {
9393 tns::LogError (isolate, tc);
94- NSLog (@" FATAL: Failed to compile require factory script" );
94+ Log (@" FATAL: Failed to compile require factory script" );
9595 return ;
9696 }
9797
9898 Local<Value> result;
9999 if (!script->Run (context).ToLocal (&result) && tc.HasCaught ()) {
100100 tns::LogError (isolate, tc);
101- NSLog (@" FATAL: Failed to run require factory script" );
101+ Log (@" FATAL: Failed to run require factory script" );
102102 return ;
103103 }
104104 if (result.IsEmpty () || !result->IsFunction ()) {
105- NSLog (@" FATAL: Require factory script did not return a function" );
105+ Log (@" FATAL: Require factory script did not return a function" );
106106 return ;
107107 }
108108
@@ -121,7 +121,7 @@ bool IsESModule(const std::string& path) {
121121 bool success =
122122 global->Set (context, tns::ToV8String (isolate, " require" ), globalRequire).FromMaybe (false );
123123 if (!success) {
124- NSLog (@" FATAL: Failed to set global require function" );
124+ Log (@" FATAL: Failed to set global require function" );
125125 }
126126}
127127
@@ -139,7 +139,7 @@ bool IsESModule(const std::string& path) {
139139 ToV8String (isolate, RuntimeConfig.ApplicationPath ))
140140 .FromMaybe (false );
141141 if (!setDir) {
142- NSLog (@" Warning: Failed to set __dirname on global object" );
142+ Log (@" Warning: Failed to set __dirname on global object" );
143143 }
144144 }
145145 }
@@ -154,12 +154,12 @@ bool IsESModule(const std::string& path) {
154154 moduleNamespace = ModuleInternal::LoadESModule (isolate, path);
155155 } catch (const NativeScriptException& ex) {
156156 if (RuntimeConfig.IsDebug ) {
157- NSLog (@" ***** JavaScript exception occurred - detailed stack trace follows *****" );
158- NSLog (@" Error loading ES module: %s " , path.c_str());
159- NSLog (@" Exception: %s " , ex.getMessage().c_str());
160- NSLog (@" ***** End stack trace - continuing execution *****" );
161- NSLog (@" Debug mode - ES module loading failed, but telling iOS it succeeded to prevent "
162- @" app termination" );
157+ Log (@" ***** JavaScript exception occurred - detailed stack trace follows *****" );
158+ Log (@" Error loading ES module: %s " , path.c_str ());
159+ Log (@" Exception: %s " , ex.getMessage ().c_str ());
160+ Log (@" ***** End stack trace - continuing execution *****" );
161+ Log (@" Debug mode - ES module loading failed, but telling iOS it succeeded to prevent "
162+ @" app termination" );
163163 return true ; // LIE TO iOS - return success to prevent app termination
164164 } else {
165165 return false ;
@@ -168,7 +168,7 @@ bool IsESModule(const std::string& path) {
168168
169169 if (moduleNamespace.IsEmpty ()) {
170170 if (RuntimeConfig.IsDebug ) {
171- NSLog (@" Debug mode - ES module returned empty namespace, but telling iOS it succeeded" );
171+ Log (@" Debug mode - ES module returned empty namespace, but telling iOS it succeeded" );
172172 return true ; // LIE TO iOS - return success to prevent app termination
173173 } else {
174174 return false ;
@@ -182,7 +182,7 @@ bool IsESModule(const std::string& path) {
182182 Local<Value> requireObj;
183183 bool success = globalObject->Get (context, ToV8String (isolate, " require" )).ToLocal (&requireObj);
184184 if (!success || !requireObj->IsFunction ()) {
185- NSLog (@" Warning: Failed to get require function from global object" );
185+ Log (@" Warning: Failed to get require function from global object" );
186186 return false ;
187187 }
188188 Local<v8::Function> requireFunc = requireObj.As <v8::Function>();
@@ -195,24 +195,24 @@ bool IsESModule(const std::string& path) {
195195
196196 if (!success || tc.HasCaught ()) {
197197 if (RuntimeConfig.IsDebug ) {
198- NSLog (@" ***** JavaScript exception occurred - detailed stack trace follows *****" );
199- NSLog (@" Error in require() call:" );
200- NSLog (@" Requested module: '%s '" , path.c_str());
201- NSLog (@" Called from: %s " , RuntimeConfig.ApplicationPath.c_str());
198+ Log (@" ***** JavaScript exception occurred - detailed stack trace follows *****" );
199+ Log (@" Error in require() call:" );
200+ Log (@" Requested module: '%s '" , path.c_str ());
201+ Log (@" Called from: %s " , RuntimeConfig.ApplicationPath .c_str ());
202202
203203 if (tc.HasCaught ()) {
204204 tns::LogError (isolate, tc);
205205 }
206206
207- NSLog (@" ***** End stack trace - continuing execution *****" );
208- NSLog (@" Debug mode - Main script execution failed, but telling iOS it succeeded to prevent "
209- @" app termination" );
207+ Log (@" ***** End stack trace - continuing execution *****" );
208+ Log (@" Debug mode - Main script execution failed, but telling iOS it succeeded to prevent "
209+ @" app termination" );
210210
211211 // Add a small delay to ensure error modal has time to render before we return
212212 dispatch_after (
213213 dispatch_time (DISPATCH_TIME_NOW, (int64_t )(0.3 * NSEC_PER_SEC)),
214214 dispatch_get_main_queue (), ^{
215- NSLog (@" 🛡️ Debug mode - Crash prevention complete, app should remain stable" );
215+ Log (@" 🛡️ Debug mode - Crash prevention complete, app should remain stable" );
216216 });
217217
218218 return true ; // LIE TO iOS - return success to prevent app termination
@@ -241,11 +241,11 @@ bool IsESModule(const std::string& path) {
241241 if (tc.HasCaught ()) {
242242 tns::LogError (isolate, tc);
243243 }
244- NSLog (@" FATAL: Failed to call require factory function" );
244+ Log (@" FATAL: Failed to call require factory function" );
245245 // Return a dummy function to avoid further crashes
246246 result = v8::Function::New (context, [](const v8::FunctionCallbackInfo<v8::Value>& info) {
247247 if (RuntimeConfig.IsDebug ) {
248- NSLog (@" Debug mode - Require function unavailable (factory failed)" );
248+ Log (@" Debug mode - Require function unavailable (factory failed)" );
249249 info.GetReturnValue ().SetUndefined ();
250250 } else {
251251 info.GetIsolate ()->ThrowException (v8::Exception::Error (
@@ -255,11 +255,11 @@ bool IsESModule(const std::string& path) {
255255 }
256256
257257 if (result.IsEmpty () || !result->IsFunction ()) {
258- NSLog (@" FATAL: Require factory did not return a function" );
258+ Log (@" FATAL: Require factory did not return a function" );
259259 // Return a dummy function
260260 result = v8::Function::New (context, [](const v8::FunctionCallbackInfo<v8::Value>& info) {
261261 if (RuntimeConfig.IsDebug ) {
262- NSLog (@" Debug mode - Require function unavailable (no function returned)" );
262+ Log (@" Debug mode - Require function unavailable (no function returned)" );
263263 info.GetReturnValue ().SetUndefined ();
264264 } else {
265265 info.GetIsolate ()->ThrowException (v8::Exception::Error (
@@ -351,7 +351,7 @@ bool IsESModule(const std::string& path) {
351351 if (success) {
352352 info.GetReturnValue ().Set (exportsObj);
353353 } else {
354- NSLog (@" Warning: Failed to get exports from module object" );
354+ Log (@" Warning: Failed to get exports from module object" );
355355 }
356356 }
357357 } catch (NativeScriptException& ex) {
@@ -481,7 +481,7 @@ bool IsESModule(const std::string& path) {
481481 bool success =
482482 moduleObj->Set (context, tns::ToV8String (isolate, " exports" ), exportsObj).FromMaybe (false );
483483 if (!success) {
484- NSLog (@" Warning: Failed to set exports property on module object" );
484+ Log (@" Warning: Failed to set exports property on module object" );
485485 }
486486
487487 const PropertyAttribute readOnlyFlags =
@@ -492,7 +492,7 @@ bool IsESModule(const std::string& path) {
492492 moduleObj->DefineOwnProperty (context, tns::ToV8String (isolate, " id" ), fileName, readOnlyFlags)
493493 .FromMaybe (false );
494494 if (!success) {
495- NSLog (@" Warning: Failed to set id property on module object" );
495+ Log (@" Warning: Failed to set id property on module object" );
496496 }
497497
498498 std::shared_ptr<Persistent<Object>> poModuleObj =
@@ -523,8 +523,8 @@ bool IsESModule(const std::string& path) {
523523 // First check if scriptValue is empty (from debug mode graceful returns)
524524 if (scriptValue.IsEmpty ()) {
525525 if (RuntimeConfig.IsDebug ) {
526- NSLog (@" Debug mode - ES module returned empty value, returning gracefully: %s " ,
527- modulePath.c_str());
526+ Log (@" Debug mode - ES module returned empty value, returning gracefully: %s " ,
527+ modulePath.c_str ());
528528 return Local<Object>();
529529 } else {
530530 throw NativeScriptException (isolate, " ES module load returned empty value " + modulePath);
@@ -533,7 +533,7 @@ bool IsESModule(const std::string& path) {
533533
534534 if (!scriptValue->IsObject ()) {
535535 if (RuntimeConfig.IsDebug ) {
536- NSLog (@" Debug mode - ES module load failed, returning gracefully: %s " , modulePath.c_str());
536+ Log (@" Debug mode - ES module load failed, returning gracefully: %s " , modulePath.c_str ());
537537 // Return empty module object to prevent crashes
538538 return Local<Object>();
539539 } else {
@@ -572,7 +572,7 @@ bool IsESModule(const std::string& path) {
572572 bool succ =
573573 moduleObj->Set (context, tns::ToV8String (isolate, " exports" ), exportsObj).FromMaybe (false );
574574 if (!succ) {
575- NSLog (@" Warning: Failed to set exports property after module execution" );
575+ Log (@" Warning: Failed to set exports property after module execution" );
576576 }
577577
578578 tempModule.SaveToCache ();
@@ -619,7 +619,7 @@ throw NativeScriptException(isolate,
619619
620620 success = moduleObj->Set (context, tns::ToV8String (isolate, " require" ), require).FromMaybe (false );
621621 if (!success) {
622- NSLog (@" Warning: Failed to set require property on module object" );
622+ Log (@" Warning: Failed to set require property on module object" );
623623 }
624624
625625 {
@@ -678,8 +678,8 @@ throw NativeScriptException(isolate,
678678 // Check if script compilation failed (debug mode graceful returns)
679679 if (script.IsEmpty ()) {
680680 if (RuntimeConfig.IsDebug ) {
681- NSLog (@" Debug mode - Classic script compilation returned empty, returning gracefully: %s " ,
682- path.c_str());
681+ Log (@" Debug mode - Classic script compilation returned empty, returning gracefully: %s " ,
682+ path.c_str ());
683683 return Local<Value>();
684684 } else {
685685 throw NativeScriptException (isolate, " Classic script compilation failed for " + path);
@@ -698,13 +698,13 @@ throw NativeScriptException(isolate,
698698 jsErrorOccurred = true ;
699699
700700 // Log the detailed JavaScript error with full stack trace
701- NSLog (@" ***** JavaScript exception occurred - detailed stack trace follows *****" );
702- NSLog (@" Error executing script: %s " , path.c_str());
701+ Log (@" ***** JavaScript exception occurred - detailed stack trace follows *****" );
702+ Log (@" Error executing script: %s " , path.c_str ());
703703 if (tc.HasCaught ()) {
704704 tns::LogError (isolate, tc);
705705 }
706- NSLog (@" ***** End stack trace - continuing execution *****" );
707- NSLog (@" Debug mode - Script execution failed, returning gracefully: %s " , path.c_str());
706+ Log (@" ***** End stack trace - continuing execution *****" );
707+ Log (@" Debug mode - Script execution failed, returning gracefully: %s " , path.c_str ());
708708 return Local<Value>();
709709 } else {
710710 if (tc.HasCaught ()) {
@@ -764,13 +764,13 @@ ScriptOrigin origin(isolate, urlString,
764764 jsErrorOccurred = true ;
765765
766766 // Log the detailed JavaScript error with full stack trace
767- NSLog (@" ***** JavaScript exception occurred - detailed stack trace follows *****" );
768- NSLog (@" Error compiling classic script: %s " , path.c_str());
767+ Log (@" ***** JavaScript exception occurred - detailed stack trace follows *****" );
768+ Log (@" Error compiling classic script: %s " , path.c_str ());
769769 if (tc.HasCaught ()) {
770770 tns::LogError (isolate, tc);
771771 }
772- NSLog (@" ***** End stack trace - continuing execution *****" );
773- NSLog (@" Debug mode - Script compilation failed, returning gracefully: %s " , path.c_str());
772+ Log (@" ***** End stack trace - continuing execution *****" );
773+ Log (@" Debug mode - Script compilation failed, returning gracefully: %s " , path.c_str ());
774774 // Return empty script to prevent crashes
775775 return Local<Script>();
776776 } else {
@@ -816,13 +816,13 @@ ScriptOrigin origin(isolate, urlString, 0, 0, false, -1, Local<Value>(), false,
816816 // V8 threw a syntax error or similar
817817 if (RuntimeConfig.IsDebug ) {
818818 // Log the detailed JavaScript error with full stack trace
819- NSLog (@" ***** JavaScript exception occurred - detailed stack trace follows *****" );
820- NSLog (@" Error compiling ES module: %s " , path.c_str());
819+ Log (@" ***** JavaScript exception occurred - detailed stack trace follows *****" );
820+ Log (@" Error compiling ES module: %s " , path.c_str ());
821821 if (tcCompile.HasCaught ()) {
822822 tns::LogError (isolate, tcCompile);
823823 }
824- NSLog (@" ***** End stack trace - continuing execution *****" );
825- NSLog (@" Debug mode - ES module compilation failed, returning gracefully: %s " , path.c_str());
824+ Log (@" ***** End stack trace - continuing execution *****" );
825+ Log (@" Debug mode - ES module compilation failed, returning gracefully: %s " , path.c_str ());
826826 // Return empty to prevent crashes
827827 return Local<Value>();
828828 } else {
@@ -859,13 +859,13 @@ ScriptOrigin origin(isolate, urlString, 0, 0, false, -1, Local<Value>(), false,
859859 if (!linked) {
860860 if (RuntimeConfig.IsDebug ) {
861861 // Log the detailed JavaScript error with full stack trace
862- NSLog (@" ***** JavaScript exception occurred - detailed stack trace follows *****" );
863- NSLog (@" Error instantiating module: %s " , path.c_str());
862+ Log (@" ***** JavaScript exception occurred - detailed stack trace follows *****" );
863+ Log (@" Error instantiating module: %s " , path.c_str ());
864864 if (tcLink.HasCaught ()) {
865865 tns::LogError (isolate, tcLink);
866866 }
867- NSLog (@" ***** End stack trace - continuing execution *****" );
868- NSLog (@" Debug mode - Module instantiation failed, returning gracefully: %s " , path.c_str());
867+ Log (@" ***** End stack trace - continuing execution *****" );
868+ Log (@" Debug mode - Module instantiation failed, returning gracefully: %s " , path.c_str ());
869869 return Local<Value>();
870870 } else {
871871 if (tcLink.HasCaught ()) {
@@ -887,13 +887,13 @@ ScriptOrigin origin(isolate, urlString, 0, 0, false, -1, Local<Value>(), false,
887887 printf (" LoadESModule: Evaluation failed for module: %s\n " , path.c_str ());
888888 if (RuntimeConfig.IsDebug ) {
889889 // Log the detailed JavaScript error with full stack trace
890- NSLog (@" ***** JavaScript exception occurred - detailed stack trace follows *****" );
891- NSLog (@" Error evaluating ES module: %s " , path.c_str());
890+ Log (@" ***** JavaScript exception occurred - detailed stack trace follows *****" );
891+ Log (@" Error evaluating ES module: %s " , path.c_str ());
892892 if (tcEval.HasCaught ()) {
893893 tns::LogError (isolate, tcEval);
894894 }
895- NSLog (@" ***** End stack trace - continuing execution *****" );
896- NSLog (@" Debug mode - Module evaluation failed, returning gracefully: %s " , path.c_str());
895+ Log (@" ***** End stack trace - continuing execution *****" );
896+ Log (@" Debug mode - Module evaluation failed, returning gracefully: %s " , path.c_str ());
897897 return Local<Value>();
898898 } else {
899899 throw NativeScriptException (isolate, tcEval, " Cannot evaluate module " + path);
@@ -935,7 +935,7 @@ ScriptOrigin origin(isolate, urlString, 0, 0, false, -1, Local<Value>(), false,
935935 jsErrorOccurred = true ;
936936
937937 // First log the detailed JavaScript error with full stack trace
938- NSLog (@" ***** JavaScript exception occurred - detailed stack trace follows *****" );
938+ Log (@" ***** JavaScript exception occurred - detailed stack trace follows *****" );
939939
940940 std::string errorTitle = " Uncaught JavaScript Exception" ;
941941 std::string errorMessage = " Module evaluation promise rejected" ;
@@ -983,9 +983,9 @@ ScriptOrigin origin(isolate, urlString, 0, 0, false, -1, Local<Value>(), false,
983983 }
984984
985985 // Log the extracted error information
986- NSLog (@" NativeScript encountered a fatal error: %s " , errorMessage.c_str());
986+ Log (@" NativeScript encountered a fatal error: %s " , errorMessage.c_str ());
987987 if (!stackTrace.empty ()) {
988- NSLog (@" JavaScript stack trace:\n %s " , stackTrace.c_str());
988+ Log (@" JavaScript stack trace:\n %s " , stackTrace.c_str ());
989989 }
990990 }
991991
@@ -994,7 +994,7 @@ ScriptOrigin origin(isolate, urlString, 0, 0, false, -1, Local<Value>(), false,
994994 tns::LogError (isolate, promiseTc);
995995 }
996996
997- NSLog (@" ***** End stack trace - Fix to continue *****" );
997+ Log (@" ***** End stack trace - Fix to continue *****" );
998998
999999 NativeScriptException::ShowErrorModal (errorTitle, errorMessage, stackTrace);
10001000
@@ -1051,7 +1051,7 @@ ScriptOrigin origin(isolate, urlString, 0, 0, false, -1, Local<Value>(), false,
10511051 Local<Value> requireObj;
10521052 bool success = globalObject->Get (context, ToV8String (isolate, " require" )).ToLocal (&requireObj);
10531053 if (!success || !requireObj->IsFunction ()) {
1054- NSLog (@" Warning: Failed to get require function from global object in RunScript" );
1054+ Log (@" Warning: Failed to get require function from global object in RunScript" );
10551055 return ;
10561056 }
10571057 Local<Value> result;
@@ -1322,7 +1322,7 @@ throw NativeScriptException(
13221322 bool success = moduleObj->Set (context, tns::ToV8String (isolate, " exports" ), proxyObject)
13231323 .FromMaybe (false );
13241324 if (!success) {
1325- NSLog (@" Warning: Failed to set exports property on proxy module object" );
1325+ Log (@" Warning: Failed to set exports property on proxy module object" );
13261326 }
13271327 }
13281328 }
@@ -1333,14 +1333,14 @@ throw NativeScriptException(
13331333 tns::ToV8String (isolate, moduleName.c_str ()))
13341334 .FromMaybe (false );
13351335 if (!success) {
1336- NSLog (@" Warning: Failed to set id property on module object" );
1336+ Log (@" Warning: Failed to set id property on module object" );
13371337 }
13381338
13391339 success =
13401340 moduleObj->Set (context, tns::ToV8String (isolate, " loaded" ), v8::Boolean::New (isolate, true ))
13411341 .FromMaybe (false );
13421342 if (!success) {
1343- NSLog (@" Warning: Failed to set loaded property on module object" );
1343+ Log (@" Warning: Failed to set loaded property on module object" );
13441344 }
13451345
13461346 // Cache the placeholder module
0 commit comments