-
Notifications
You must be signed in to change notification settings - Fork 684
Make logging an optional feature and disable it by default #2449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Results on binary size (and on RSS in consequence):
Binary sizes (bytes) (~1.8k gain) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good patch, but needs some improvements.
jerry-core/CMakeLists.txt
Outdated
@@ -66,6 +67,12 @@ if(JERRY_CMDLINE_SNAPSHOT) | |||
set(FEATURE_SNAPSHOT_SAVE_MESSAGE " (FORCED BY SNAPSHOT TOOL)") | |||
endif() | |||
|
|||
if(FEATURE_DEBUGGER OR FEATURE_MEM_STATS OR FEATURE_PARSER_DUMP OR FEATURE_REGEXP_DUMP) | |||
set(FEATURE_LOGGING ON) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debugging should not force logging.
jerry-core/parser/js/common.c
Outdated
@@ -74,6 +76,7 @@ util_print_number (ecma_number_t num_p) /**< number to print */ | |||
lit_utf8_byte_t str_buf[ECMA_MAX_CHARS_IN_STRINGIFIED_NUMBER]; | |||
lit_utf8_size_t str_size = ecma_number_to_utf8_string (num_p, str_buf, sizeof (str_buf)); | |||
str_buf[str_size] = 0; | |||
JERRY_UNUSED (str_buf); // potentially |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will forget adding these macros. Just like asserts, logging should reference its arguments.
jerry-core/parser/js/js-parser.c
Outdated
JERRY_DEBUG_MSG (is_constructor ? "\n--- Class constructor parsing end ---\n\n" | ||
: "\n--- Function parsing end ---\n\n"); | ||
JERRY_DEBUG_MSG ("\n--- %s parsing end ---\n\n", | ||
context_p->status_flags & PARSER_CLASS_CONSTRUCTOR ? "Class constructor" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brackets around context_p->status_flags & PARSER_CLASS_CONSTRUCTOR
.
PR updated according to the reviews Note 1: "Just like asserts, logging should reference its arguments." This needed some macro black magic as the classic Note 2: As of late, the ESP target has been erroring. It makes all PRs red (including this one). Hope it's only some instability that goes away soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss [email protected]
654c19e
to
817fb58
Compare
Commits squashed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss [email protected]