I have been reading about how to keep error/warning logs of a C program on Linux environment. Is it better to write the errno
to a file as it is done here or is it better to use syslog
or setlogmask
system calls or another method? I would appreciate an answer with an example code.
I would strongly suggest using syslog for logging errors as its more standard way of logging.
you can look at the example implemenation here (bio3d.colorado.edu/tor/sadocs/misc/syslog.html)
Also unix network programming book by richard stevens also contains good explanation of using syslog