Skip to content
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

HEXDUMP log gives warning when logging function name. #26170

Closed
Emil-Gydesen-Bose opened this issue Jun 13, 2020 · 4 comments · Fixed by #26178 or #31535
Closed

HEXDUMP log gives warning when logging function name. #26170

Emil-Gydesen-Bose opened this issue Jun 13, 2020 · 4 comments · Fixed by #26178 or #31535
Assignees
Labels
area: Logging Enhancement Changes/Updates/Additions to existing features

Comments

@Emil-Gydesen-Bose
Copy link
Contributor

Describe the bug
At least for BT_HEXDUMP_DBG the log statement does not include the function name, and if you add the function name as part of the string supplied by the caller, then this warning: WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'my_func', this function's name, in a string appears. Since it's not possible add formatting to HEX_DUMP log strings (without additional steps), this warning cannot easily be dealt with.

To Reproduce
Create a function that logs it's own name using e.g. BT_HEXDUMP_DBG:

void my_func(void *data, uint16_t data_len)
{
    BT_HEXDUMP_DBG(data, data_len, "my_func was called");
}

Log should be something like

[00:01:03.770,000] <dbg> bt_my_file.my_func was called
...

Expected behavior
That either there is no warning, or that the log statement automatically includes the function name (similar to BT_DBG).

Impact
Very low as it is just a warning.

Additional context
Add any other context about the problem here.

@nordic-krch
Copy link
Contributor

Unfortunately, it is hexdump limitation that it cannot have function prefix. Added clarification to kconfig and doc.

@Emil-Gydesen-Bose
Copy link
Contributor Author

Unfortunately, it is hexdump limitation that it cannot have function prefix. Added clarification to kconfig and doc.

The limitation is fine, but then it should perhaps be "legal" for the application to log the function name (even as a literal string rather than __func__). Not sure if that can easily (or at all) be done for the check_compliance script.

@Emil-Gydesen-Bose
Copy link
Contributor Author

Solutions for this issue has been discussed in #26178

@carlescufi
Copy link
Member

Reopening as enhancement as per this comment

@carlescufi carlescufi added Enhancement Changes/Updates/Additions to existing features and removed bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug labels Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Logging Enhancement Changes/Updates/Additions to existing features
Projects
None yet
3 participants