[riot-devel] Lightweight Syslog Implementation

Robin robin at chilio.net
Tue May 28 18:53:25 CEST 2019


Hi Kaspar,

> See above. There's an example log backend in sys/log/log_printfnoformat
> showing how to create a logging backend module. It should be straigh
> forward to use syslog there.
i just found some time to have a short look into the logging API. I tried to compile my tests with the log_printfnoformat module. As       i understand the interface, I just need to add "USEMODULE += log_printfnoformat" to my application?

Sadly this leads to a compile time error: "fatal error: log_module.h: No such file or directory". Looks like the includes not work as expected. I will have a look later and maybe create an issue/PR if it’s not a problem caused by my application. 

Besides that it should be fairly easy to move the syslog implementation to the LOG API since the interfaces already are very similar as Juan mentioned. Only problem here is that syslog as implemented in gLibc expects a user to issue a call to openlog first. Maybe I can make the call to openlog implicit and thus make it compatible to both API‘s. Another solution could be to extend the log module with a bootstrap/init function which defaults to do nothing in most cases.

One problem with the generic LOG approach that comes to my mind is that it looks like a all or nothing approach. When I implement the syslog implementation as a log module it wouldn’t be possible anymore for the user to decide which logs should be shipped via syslog and which logs only should be send over serial line. Further, it would be critical to start syslog with serial logging by default to not loose any messages before the syslogd thread started. Maybe I would keep the syslog module in place as a separate module and only make a wrapper in the log API which depends on the syslog module. That way one could use both approaches. 



You got any thoughts on this ?



Thanks

Robin 




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20190528/80b49e92/attachment.html>


More information about the devel mailing list