xiaoxiang781216 commented on a change in pull request #3050:
URL: https://github.com/apache/incubator-nuttx/pull/3050#discussion_r594601995



##########
File path: drivers/syslog/syslog_channel.c
##########
@@ -141,8 +145,14 @@ int syslog_channel(FAR const struct syslog_channel_s 
*channel)
     {
       DEBUGASSERT(channel->sc_putc != NULL && channel->sc_force != NULL);
 
-      g_syslog_channel = channel;
-      return OK;
+      for (int i = 0; i < CONFIG_SYSLOG_MAX_CHANNELS; i++)

Review comment:
       > OK, lets recap this:
   > 
   > * `syslog_channel` will be retained and it will substitute the default 
channel with the provided one.
   > * `syslog_channel_add` will be introduced and it will append a new channel 
to the list.
   > * `syslog_channel_remove` will be introduced and it will remove a channel 
from the list.
   > 
   > Some questions:
   > 
   > * Which is the "default" channel? May I assume that it will always be the 
first in the list?
   
   Most likely the first, or if `syslog_channel` remove all channel before add 
self then we don't need to know which one is the default.
   
   > * Functions like `syslog_file_channel` will use the substitute or the add 
function? I would go for the addition.
   
   But, it will fail to add in case of CONFIG_SYSLOG_MAX_CHANNELS == 1. That's 
why I suggest that `syslog_channel` change the behaviour based on 
CONFIG_SYSLOG_MAX_CHANNELS, or syslog_file_channel call different 
API(syslog_channel/syslog_channel_add) to register self.




----------------------------------------------------------------
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.

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


Reply via email to