linguini1 commented on code in PR #16493:
URL: https://github.com/apache/nuttx/pull/16493#discussion_r2143236079


##########
drivers/syslog/vsyslog_rfc5424.c:
##########
@@ -0,0 +1,258 @@
+/****************************************************************************
+ * drivers/syslog/vsyslog_rfc5424.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <syslog.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/clock.h>
+#include <nuttx/init.h>
+#include <nuttx/streams.h>
+#include <nuttx/syslog/syslog.h>
+
+#include "syslog.h"
+
+/****************************************************************************
+ * Preprocessor definitions
+ ****************************************************************************/
+
+/* RFC5424 NILVALUE encoding */
+
+#define NILVALUE "-"
+#define NILVALUE_SPACE NILVALUE " "
+
+/* RFC5424 timestamp format string (fractional seconds and 'Z' added by
+ * appending to format string)
+ */
+
+#define RFC_STRFTIME "%Y-%m-%dT%H:%M:%S"
+
+/* RFC5424 structured data options were selected */
+
+#if defined(CONFIG_SYSLOG_RFC5424_TIMEQUALITY)

Review Comment:
   > I do not really understand this defines. I see that HAVE_RFC5424_SDATA is 
defined based on the presence of the CONFIG_SYSLOG_RFC5424_TIMEQUALITY. But we 
use both HAVE_RFC5424_SDATA and CONFIG_SYSLOG_RFC5424_TIMEQUALITY throughout 
the file. I do not think this indirection helps in any way, my suggestion is to 
drop the HAVE_RFC5424_SDATA define and use use 
CONFIG_SYSLOG_RFC5424_TIMEQUALITY directly. Am I missing something?
   
   The reason I've structured it this way is because there are many different 
kinds of structured data you can add to an RFC5424 syslog. I've only 
implemented one, `timeQuality`. However, this conditional would depend on every 
other structured data option. This is basically for shorthand because it would 
be annoying to type out the list of all the conditionals later (see 
vsyslog.c:150).



-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to