11/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
2+ * Copyright 2016 University of Szeged.
23 *
34 * Licensed under the Apache License, Version 2.0 (the "License");
45 * you may not use this file except in compliance with the License.
@@ -33,13 +34,13 @@ void __noreturn
3334jerry_fatal (jerry_fatal_code_t code ) /**< status code */
3435{
3536#ifndef JERRY_NDEBUG
36- printf ( "Error: " );
37+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "Error: " );
3738
3839 switch (code )
3940 {
4041 case ERR_OUT_OF_MEMORY :
4142 {
42- printf ( "ERR_OUT_OF_MEMORY\n" );
43+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "ERR_OUT_OF_MEMORY\n" );
4344 break ;
4445 }
4546 case ERR_SYSCALL :
@@ -49,17 +50,17 @@ jerry_fatal (jerry_fatal_code_t code) /**< status code */
4950 }
5051 case ERR_REF_COUNT_LIMIT :
5152 {
52- printf ( "ERR_REF_COUNT_LIMIT\n" );
53+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "ERR_REF_COUNT_LIMIT\n" );
5354 break ;
5455 }
5556 case ERR_UNIMPLEMENTED_CASE :
5657 {
57- printf ( "ERR_UNIMPLEMENTED_CASE\n" );
58+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "ERR_UNIMPLEMENTED_CASE\n" );
5859 break ;
5960 }
6061 case ERR_FAILED_INTERNAL_ASSERTION :
6162 {
62- printf ( "ERR_FAILED_INTERNAL_ASSERTION\n" );
63+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "ERR_FAILED_INTERNAL_ASSERTION\n" );
6364 break ;
6465 }
6566 }
@@ -83,8 +84,12 @@ jerry_assert_fail (const char *assertion, /**< assertion condition string */
8384 const uint32_t line ) /**< line */
8485{
8586#ifndef JERRY_NDEBUG
86- printf ("ICE: Assertion '%s' failed at %s(%s):%lu.\n" ,
87- assertion , file , function , (unsigned long ) line );
87+ jerry_port_log (JERRY_LOG_LEVEL_ERROR ,
88+ "ICE: Assertion '%s' failed at %s(%s):%lu.\n" ,
89+ assertion ,
90+ file ,
91+ function ,
92+ (unsigned long ) line );
8893#else /* JERRY_NDEBUG */
8994 (void ) assertion ;
9095 (void ) file ;
@@ -106,7 +111,11 @@ jerry_unreachable (const char *comment, /**< comment to unreachable mark if exis
106111 const uint32_t line ) /**< line */
107112{
108113#ifndef JERRY_NDEBUG
109- printf ("ICE: Unreachable control path at %s(%s):%lu was executed" , file , function , (unsigned long ) line );
114+ jerry_port_log (JERRY_LOG_LEVEL_ERROR ,
115+ "ICE: Unreachable control path at %s(%s):%lu was executed" ,
116+ file ,
117+ function ,
118+ (unsigned long ) line );
110119#else /* JERRY_NDEBUG */
111120 (void ) file ;
112121 (void ) function ;
@@ -115,9 +124,10 @@ jerry_unreachable (const char *comment, /**< comment to unreachable mark if exis
115124
116125 if (comment != NULL )
117126 {
118- printf ( "(%s)" , comment );
127+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "(%s)" , comment );
119128 }
120- printf (".\n" );
129+
130+ jerry_port_log (JERRY_LOG_LEVEL_ERROR , ".\n" );
121131
122132 jerry_fatal (ERR_FAILED_INTERNAL_ASSERTION );
123133} /* jerry_unreachable */
@@ -133,7 +143,11 @@ jerry_unimplemented (const char *comment, /**< comment to unimplemented mark if
133143 const uint32_t line ) /**< line */
134144{
135145#ifndef JERRY_NDEBUG
136- printf ("SORRY: Unimplemented case at %s(%s):%lu was executed" , file , function , (unsigned long ) line );
146+ jerry_port_log (JERRY_LOG_LEVEL_ERROR ,
147+ "SORRY: Unimplemented case at %s(%s):%lu was executed" ,
148+ file ,
149+ function ,
150+ (unsigned long ) line );
137151#else /* JERRY_NDEBUG */
138152 (void ) file ;
139153 (void ) function ;
@@ -142,9 +156,10 @@ jerry_unimplemented (const char *comment, /**< comment to unimplemented mark if
142156
143157 if (comment != NULL )
144158 {
145- printf ( "(%s)" , comment );
159+ jerry_port_log ( JERRY_LOG_LEVEL_ERROR , "(%s)" , comment );
146160 }
147- printf (".\n" );
161+
162+ jerry_port_log (JERRY_LOG_LEVEL_ERROR , ".\n" );
148163
149164 jerry_fatal (ERR_UNIMPLEMENTED_CASE );
150165} /* jerry_unimplemented */
0 commit comments