@@ -48,14 +48,14 @@ read_file (const char *file_name,
4848 FILE * file = fopen (file_name , "r" );
4949 if (file == NULL )
5050 {
51- jerry_port_errormsg ( "Error: failed to open file: %s\n" , file_name );
51+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "Error: failed to open file: %s\n" , file_name );
5252 return NULL ;
5353 }
5454
5555 size_t bytes_read = fread (buffer , 1u , sizeof (buffer ), file );
5656 if (!bytes_read )
5757 {
58- jerry_port_errormsg ( "Error: failed to read file: %s\n" , file_name );
58+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "Error: failed to read file: %s\n" , file_name );
5959 fclose (file );
6060 return NULL ;
6161 }
@@ -85,7 +85,7 @@ assert_handler (const jerry_value_t func_obj_val __attribute__((unused)), /**< f
8585 }
8686 else
8787 {
88- jerry_port_errormsg ( "Script error: assertion failed\n" );
88+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "Script error: assertion failed\n" );
8989 exit (JERRY_STANDALONE_EXIT_CODE_FAIL );
9090 }
9191} /* assert_handler */
@@ -126,8 +126,10 @@ main (int argc,
126126{
127127 if (argc > JERRY_MAX_COMMAND_LINE_ARGS )
128128 {
129- jerry_port_errormsg ("Error: too many command line arguments: %d (JERRY_MAX_COMMAND_LINE_ARGS=%d)\n" ,
130- argc , JERRY_MAX_COMMAND_LINE_ARGS );
129+ jerry_port_log (JERRY_LOG_LEVEL_ERROR ,
130+ "Error: too many command line arguments: %d (JERRY_MAX_COMMAND_LINE_ARGS=%d)\n" ,
131+ argc ,
132+ JERRY_MAX_COMMAND_LINE_ARGS );
131133
132134 return JERRY_STANDALONE_EXIT_CODE_FAIL ;
133135 }
@@ -193,14 +195,14 @@ main (int argc,
193195
194196 if (save_snapshot_file_name_p != NULL )
195197 {
196- jerry_port_errormsg ( "Error: snapshot file name already specified\n" );
198+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "Error: snapshot file name already specified\n" );
197199 print_usage (argv [0 ]);
198200 return JERRY_STANDALONE_EXIT_CODE_FAIL ;
199201 }
200202
201203 if (++ i >= argc )
202204 {
203- jerry_port_errormsg ( "Error: no file specified for %s\n" , argv [i - 1 ]);
205+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "Error: no file specified for %s\n" , argv [i - 1 ]);
204206 print_usage (argv [0 ]);
205207 return JERRY_STANDALONE_EXIT_CODE_FAIL ;
206208 }
@@ -211,7 +213,7 @@ main (int argc,
211213 {
212214 if (++ i >= argc )
213215 {
214- jerry_port_errormsg ( "Error: no file specified for %s\n" , argv [i - 1 ]);
216+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "Error: no file specified for %s\n" , argv [i - 1 ]);
215217 print_usage (argv [0 ]);
216218 return JERRY_STANDALONE_EXIT_CODE_FAIL ;
217219 }
@@ -223,14 +225,14 @@ main (int argc,
223225 {
224226 if (++ i >= argc )
225227 {
226- jerry_port_errormsg ( "Error: no level specified for %s\n" , argv [i - 1 ]);
228+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "Error: no level specified for %s\n" , argv [i - 1 ]);
227229 print_usage (argv [0 ]);
228230 return JERRY_STANDALONE_EXIT_CODE_FAIL ;
229231 }
230232
231233 if (strlen (argv [i ]) != 1 || argv [i ][0 ] < '0' || argv [i ][0 ] > '3' )
232234 {
233- jerry_port_errormsg ( "Error: wrong format for %s\n" , argv [i - 1 ]);
235+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "Error: wrong format for %s\n" , argv [i - 1 ]);
234236 print_usage (argv [0 ]);
235237 return JERRY_STANDALONE_EXIT_CODE_FAIL ;
236238 }
@@ -244,7 +246,7 @@ main (int argc,
244246 {
245247 if (++ i >= argc )
246248 {
247- jerry_port_errormsg ( "Error: no file specified for %s\n" , argv [i - 1 ]);
249+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "Error: no file specified for %s\n" , argv [i - 1 ]);
248250 print_usage (argv [0 ]);
249251 return JERRY_STANDALONE_EXIT_CODE_FAIL ;
250252 }
@@ -260,7 +262,7 @@ main (int argc,
260262 }
261263 else if (!strncmp ("-" , argv [i ], 1 ))
262264 {
263- jerry_port_errormsg ( "Error: unrecognized option: %s\n" , argv [i ]);
265+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "Error: unrecognized option: %s\n" , argv [i ]);
264266 print_usage (argv [0 ]);
265267 return JERRY_STANDALONE_EXIT_CODE_FAIL ;
266268 }
@@ -274,13 +276,15 @@ main (int argc,
274276 {
275277 if (files_counter != 1 )
276278 {
277- jerry_port_errormsg ("Error: --save-snapshot argument works with exactly one script\n" );
279+ jerry_port_log (JERRY_LOG_LEVEL_ERROR ,
280+ "Error: --save-snapshot argument works with exactly one script\n" );
278281 return JERRY_STANDALONE_EXIT_CODE_FAIL ;
279282 }
280283
281284 if (exec_snapshots_count != 0 )
282285 {
283- jerry_port_errormsg ("Error: --save-snapshot and --exec-snapshot options can't be passed simultaneously\n" );
286+ jerry_port_log (JERRY_LOG_LEVEL_ERROR ,
287+ "Error: --save-snapshot and --exec-snapshot options can't be passed simultaneously\n" );
284288 return JERRY_STANDALONE_EXIT_CODE_FAIL ;
285289 }
286290 }
@@ -297,7 +301,7 @@ main (int argc,
297301 jerry_log_file = fopen (log_file_name , "w" );
298302 if (jerry_log_file == NULL )
299303 {
300- jerry_port_errormsg ( "Error: failed to open log file: %s\n" , log_file_name );
304+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "Error: failed to open log file: %s\n" , log_file_name );
301305 return JERRY_STANDALONE_EXIT_CODE_FAIL ;
302306 }
303307 }
@@ -321,7 +325,7 @@ main (int argc,
321325
322326 if (!is_assert_added )
323327 {
324- jerry_port_errormsg ( "Warning: failed to register 'assert' method." );
328+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "Warning: failed to register 'assert' method." );
325329 }
326330
327331 jerry_value_t ret_value = jerry_create_undefined ();
@@ -489,7 +493,7 @@ main (int argc,
489493 assert (sz == err_str_size );
490494 err_str_buf [err_str_size ] = 0 ;
491495
492- jerry_port_errormsg ( "Script Error: unhandled exception: %s\n" , err_str_buf );
496+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "Script Error: unhandled exception: %s\n" , err_str_buf );
493497
494498 jerry_release_value (err_str_val );
495499
0 commit comments