-
Notifications
You must be signed in to change notification settings - Fork 6
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
chore: Use Zephyr logging macros directly #121
Conversation
Zephyr logging is a complex thing that does a lot of magic and optimizations. Using the macros from one place with a single '%s' argument leaves no room for magic. By using the macros directly from various places in our sources and with the various arguments, we give the magic a chance to happen. Signed-off-by: Vratislav Podzimek <[email protected]>
At least we know now. We must look somewhere else to remove crashes. |
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.
I agree in that the logging is the biggest issue that we have right now when it comes to stack usage.
But with this change I don't see the vision of what mender-log
is going to become. We are now mixing platform specific code in the header file (I understand why), but with that the implementation in the .c
an the whole concept of this api is redundant.
We cannot do much right now with the current structure of public APIs. But this ideally should not be exposed as a library (mender-log.h) and just use a set of macros in mender-utils.h
like MENDER_LOG_INFO that does LOG_INFO on Zephyr, and SOMETHING_ELSE in future platforms .
I don't see a difference between this being in
in |
My point is to drop the
Yes, and drop the |
But you need to do some initialization. The |
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.
My point is to drop the
.c
file(s). Hence making it header only once it is already platform specific in there.But you need to do some initialization. The
mender_log_init()
is empty for now, but still we at least need to doLOG_MODULE_REGISTER()
exactly once somewhere.
You are totally right.
Why do you think having a
.c
file as well is an issue?
Is just the whole concept of it as a portable library (not technically a library, but I don't know how to call it) is strange when the platform code is already in the header file.
Anyway, I think I took this discussion to far away, the core problem of this PR is solved, and the resulting binary code does what I think is best: map one to one into Zephyr log macros. Let's move into other problems 👍
Zephyr logging is a complex thing that does a lot of magic and optimizations. Using the macros from one place with a single '%s' argument leaves no room for magic. By using the macros directly from various places in our sources and with the various arguments, we give the magic a chance to happen.
Note
This makes zero difference in how things work (or rather doesn't) on my ESP32-EVB board. The only difference is that I now see the full URL:
(so the changes are applied and "working")