I would like to redirect NSog() to file, but still to see the output in console.
I am aware that stderr can be redirected to file using:
The way we have implemented is:
if (!isatty(STDERR_FILENO)) {
// Redirection code
}
This is based on general assumption that if a console is attached, you do not need to store those logs in the file since you are already debugging. So whenever the console is attached, logs will be printed there, otherwise saved to a file.