I started working on this.
Indeed I made g_default_channel an array.

I modified all output functions to use all available channels in the list.
It worked correctly, but still the code is not clean enough to PR it.

There are some issues to be resolved, before "finalizing" the code.

1. What is the most appropriate way to implement this?
For the moment, functions like syslog_putc iterate over all entries of this
table, outputting to all channels.
Maybe it should be better to do this on a higher-level? Loop the array and
call syslogstream_create for every channel?

2. How should errors be handled in case of multiple channels?
Now nx_vsyslog returns the number of characters written (although it is not
used anywhere).
In case of multiple channels, what should be returned? A channel may fail,
and write less characters than the other.

Στις Σάβ, 23 Ιαν 2021 στις 2:39 μ.μ., ο/η Xiang Xiao <
xiaoxiang781...@gmail.com> έγραψε:

> On Thu, Jan 21, 2021 at 7:27 AM Fotis Panagiotopoulos <f.j.pa...@gmail.com
> >
> wrote:
>
> > Hi,
> >
> > I am in need of having the syslog to output to multiple channels.
> > There shall be a file in an SD card where syslog will always output the
> > messages.
> > Simultaneously I need to be able to see the log in real-time in a serial
> > console, or possibly through network.
> >
> >
> Yes, it's a very useful feature.
>
>
> > Is this possible? As far as I can tell, there can be only one syslog
> active
> > at a time?
> >
>
> But, it isn't supported by NuttX directly now.
>
>
> > Or is there any way to redirect it to multiple outputs?
> >
>
> One approach is change g_syslog_channel to list:
>
> https://github.com/apache/incubator-nuttx/blob/master/drivers/syslog/syslog_channel.c#L110
> and forward the log to all entries in the list.
>

Reply via email to