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

Have logging on zephyr use sys_log mechanism #38

Closed
galak opened this issue Apr 6, 2018 · 4 comments
Closed

Have logging on zephyr use sys_log mechanism #38

galak opened this issue Apr 6, 2018 · 4 comments

Comments

@galak
Copy link
Collaborator

galak commented Apr 6, 2018

We currently use printk, but should tie into the proper logging system in zephyr via include/logging/sys_log.h.

@galak galak mentioned this issue Apr 6, 2018
@skordal
Copy link

skordal commented Apr 10, 2018

This won't directly work with the current libmetal logging API. The problem is that the Zephyr syslog APIs are macros (SYS_LOG_ERR()/SYS_LOG_WRN/etc), so we can't call them correctly from the libmetal log handler.

However, we could call the SYS_LOG_BACKEND_FN instead of printk from the log handler. We won't get color support or the consistent logging format provided by the SYS_LOG_ macros, but we can support custom Zephyr logging functions (syslog_hook).

@galak
Copy link
Collaborator Author

galak commented Apr 10, 2018

I'll add a comment to zephyrproject-rtos/zephyr#6186 to improve the logging API in zephyr to allow us to connect this more directly.

@galak
Copy link
Collaborator Author

galak commented Apr 10, 2018

@skordal can we use or tie into LOG_NO_COLOR()?

@skordal
Copy link

skordal commented Apr 11, 2018

That won't work either, we will need a function that can take a va_list argument, since we need to forward the arguments passed to the libmetal log handler function.

(My suggestion about using the SYS_LOG_BACKEND_FN actually won't work either, for the same reason).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants