Skip to content

Commit 033324c

Browse files
committed
Remove log file from API level
The port implementation should define the destination of log messages. JerryScript-DCO-1.0-Signed-off-by: László Langó [email protected]
1 parent bcfa39e commit 033324c

File tree

4 files changed

+2
-50
lines changed

4 files changed

+2
-50
lines changed

jerry-core/jerry-api.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ typedef bool (*jerry_object_property_foreach_t) (const jerry_value_t property_na
162162
*/
163163
#ifdef JERRY_ENABLE_LOG
164164
extern int jerry_debug_level;
165-
extern FILE *jerry_log_file;
166165
#endif /* JERRY_ENABLE_LOG */
167166

168167
/**

jerry-core/jerry.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,6 @@ static const char *wrong_args_msg_p = "wrong type of argument";
8686
*/
8787
int jerry_debug_level = 0;
8888

89-
/**
90-
* File, used for logging
91-
*/
92-
FILE *jerry_log_file = NULL;
93-
9489
#endif /* JERRY_ENABLE_LOG */
9590

9691
/**

jerry-core/jrt/jrt.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ extern void __noreturn jerry_unimplemented (const char *, const char *, const ch
8686
#define JERRY_LOG(lvl, ...) \
8787
do \
8888
{ \
89-
if (lvl <= jerry_debug_level && jerry_log_file) \
89+
if (lvl <= jerry_debug_level) \
9090
{ \
91-
jerry_port_logmsg (jerry_log_file, __VA_ARGS__); \
91+
jerry_port_log (JERRY_LOG_LEVEL_DEBUG, __VA_ARGS__); \
9292
} \
9393
} \
9494
while (0)

main-unix.c

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ print_help (char *name)
114114
" --save-snapshot-for-eval FILE\n"
115115
" --exec-snapshot FILE\n"
116116
" --log-level [0-3]\n"
117-
" --log-file FILE\n"
118117
" --abort-on-fail\n"
119118
"\n",
120119
name);
@@ -156,9 +155,6 @@ main (int argc,
156155

157156
bool is_repl_mode = false;
158157

159-
#ifdef JERRY_ENABLE_LOG
160-
const char *log_file_name = NULL;
161-
#endif /* JERRY_ENABLE_LOG */
162158
for (i = 1; i < argc; i++)
163159
{
164160
if (!strcmp ("-h", argv[i]) || !strcmp ("--help", argv[i]))
@@ -240,20 +236,6 @@ main (int argc,
240236
#ifdef JERRY_ENABLE_LOG
241237
flags |= JERRY_INIT_ENABLE_LOG;
242238
jerry_debug_level = argv[i][0] - '0';
243-
#endif /* JERRY_ENABLE_LOG */
244-
}
245-
else if (!strcmp ("--log-file", argv[i]))
246-
{
247-
if (++i >= argc)
248-
{
249-
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Error: no file specified for %s\n", argv[i - 1]);
250-
print_usage (argv[0]);
251-
return JERRY_STANDALONE_EXIT_CODE_FAIL;
252-
}
253-
254-
#ifdef JERRY_ENABLE_LOG
255-
flags |= JERRY_INIT_ENABLE_LOG;
256-
log_file_name = argv[i];
257239
#endif /* JERRY_ENABLE_LOG */
258240
}
259241
else if (!strcmp ("--abort-on-fail", argv[i]))
@@ -295,22 +277,6 @@ main (int argc,
295277
is_repl_mode = true;
296278
}
297279

298-
#ifdef JERRY_ENABLE_LOG
299-
if (log_file_name)
300-
{
301-
jerry_log_file = fopen (log_file_name, "w");
302-
if (jerry_log_file == NULL)
303-
{
304-
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Error: failed to open log file: %s\n", log_file_name);
305-
return JERRY_STANDALONE_EXIT_CODE_FAIL;
306-
}
307-
}
308-
else
309-
{
310-
jerry_log_file = stdout;
311-
}
312-
#endif /* JERRY_ENABLE_LOG */
313-
314280
jerry_init (flags);
315281

316282
jerry_value_t global_obj_val = jerry_get_global_object ();
@@ -470,14 +436,6 @@ main (int argc,
470436
jerry_release_value (print_function);
471437
}
472438

473-
#ifdef JERRY_ENABLE_LOG
474-
if (jerry_log_file && jerry_log_file != stdout)
475-
{
476-
fclose (jerry_log_file);
477-
jerry_log_file = NULL;
478-
}
479-
#endif /* JERRY_ENABLE_LOG */
480-
481439
int ret_code = JERRY_STANDALONE_EXIT_CODE_OK;
482440

483441
if (jerry_value_has_error_flag (ret_value))

0 commit comments

Comments
 (0)