[riot-notifications] [RIOT-OS/RIOT] Add basic syslog implementation (#11362)

Matthias Miehl notifications at github.com
Mon May 27 13:08:58 CEST 2019


makomi commented on this pull request.



> +#include <unistd.h>
+#include <time.h>
+#include <netdb.h>
+
+#define ENABLE_DEBUG (0)
+#include "debug.h"
+
+#include "syslog/syslog.h"
+#include "xtimer.h"
+
+static char buf[SYSLOG_BUF_NUMOF][SYSLOG_MAX_LEN];
+static syslog_msg_t _msg[SYSLOG_BUF_NUMOF];
+static char _ident[IDENT_MAX_LEN];
+static char hostname[HOST_NAME_MAX];
+static mutex_t syslog_mutex = MUTEX_INIT;
+static int _facility = 0;

True, the compiler does not care whether one writes the additional assignment.

I would drop it, since for me it makes the code easier to read but I am not sure if it is considered best practice and I am not aware of any related RIOT-OS guideline. One might argue that omitting the explicit initialization hides what is happening, making the code more difficult to read.

I guess, I just wanted to point it out and see what you think of it, since you explicitly initialized `_facility` but not e.g. `_ident`. But to be clear, I don't think it really matters. This was just my curiosity speaking.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11362#discussion_r287747600
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190527/09587ff6/attachment.html>


More information about the notifications mailing list