juniskane edited a comment on issue #382: syslog/file: Remove 
syslog_dev_uninitialize in syslog_file_channel
URL: https://github.com/apache/incubator-nuttx/pull/382#issuecomment-591822072
 
 
   I see no reason to restrict this to kernel only and that limitation is not 
in the API documentation. The ability to change syslog stream dynamically is 
*extremely useful* for testing. I can envision board level logic doing that 
after some BOARDIOC so it is not relevant if this function is called directly 
from app code or not. I currently use the "side effect" of (syslog internal) 
variables retaining their value in flat builds over multiple program 
invocations:
   
   ```
    const char *syslog_file;
      /* ... this is in app main(), ... get syslog_file from argv... */
    
      if (syslog_file)
        {
    #ifdef CONFIG_SYSLOG_FILE
         /* Convenience names. */
          if (strcmp(syslog_file, "usb") == 0)
            syslog_file = "/dev/ttyACM0";
          else if (strcmp(syslog_file, "uart") == 0)
            syslog_file = "/dev/ttyS3";
          if (syslog_file_channel(syslog_file) < 0)
            fprintf(stderr, "Cannot set syslog to %s\n", syslog_file);
    #else
          fprintf(stderr, "Cannot set syslog to %s\n", syslog_file);
    #endif
          exit(0);
       }
   ```
   

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


With regards,
Apache Git Services

Reply via email to