wangchdo opened a new pull request, #17018:
URL: https://github.com/apache/nuttx/pull/17018
The current syslog will alway log by rawstream,
which will always firstly put the message to a
buffer and then flush them by calling syslog_write().
syslog_write() will alway broadcast them to all channels.
There are some drawbacks:
1) The rawstream buffer is allocated in the caller's
stack as temperory variable, which cause huge stack usage,
this is not good for the platform wit limited resource
2) In interrupt context, syslog() will firstly put the message
in a global buffer, using a spinlock to protect it, which will
cause dead lock in some cases in multicore system, when
doing syslog in exception context from interrupt
3) syslog_write() will always broadcast to all the channels,
so it can only be used when all the channels are ready, making
syslog() not able to be used at the early age during boot.
4) with some options enabled syslog() relies on kernel to be ready
before it can be used, for example getting kernel
state or timestamp and put them with the message, this will also make
syslog() not able to work before kernel is ready.
This patch introduced LOG_CONSOLE_DEBUG priority to syslog(),
which is implemented in a light-weight way: no buffering, unicast and
no relying on kernel is ready. Calling syslog() with this priority
the message will always be sent to console in a synchronous way,
and users can use it as long as uart early initializing is completed,
which is before nx_start() is called.
*Note: Please adhere to [Contributing
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
## Summary
Add a new syslog function that is light-weight, synchronsou, unicast and
output with console
## Impact
A new syslog function was added, no impact to other parts
## Testing
Ostest passed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]