t/f = slog(pty,msg[,fac])
Typically, a syslog() function call passes a "pty" priority "msg" string to the "fac" system log facility. If fac is omitted, its value defaults to that used in the last log() call, or USER if there was no previous call. Log messages are always prepended with the program name and pid. Returns true if successful or a null if any errors are detected. Valid values of fac are AUTH, AUTHPRIV, CRON, DAEMON, FTP, LOCAL0 through LOCAL7, LPR, MAIL, NEWS, USER or UUCP. Valid values of pty are (in decreasing importance) EMERG, ALERT, CRIT, ERR, WARNING, NOTICE, INFO or DEBUG. These values must be strings, in any mixture of case.
Logging may also be performed simply by writing to stdout and/or stderr after their respective files have been close()d. This is often more convenient because the say() and cry() functions can automatically translate messages into other languages, using the text translation database, which the log() function itself does not. This is so useful the daemon() function automatically closes both files when creating a background function, unless the debug option (-d) is used when starting the program.
This makes it much easier to design and test "server" programs. Informational messages are simply written with say() and error messages with cry(), after the program has been sent to background with daemon(). In debug mode, the program can be tested from the command line, with both outputs appearing on the terminal. Once testing is complete, the program is run without debug mode and production output is sent to the system log facility (with USER.INFO and USER.ERR priority, respectively).