Write diagnostic output to the channel’s log file.
void mtaLog(const char *fmt, ...);
Arguments |
Description |
---|---|
fmt |
Pointer to a printf() formatting string. The string must be NULL terminated. See your platform’s C run-time library documentation for information on the formatting substitutions accepted by printf(). |
Programs that wish to write diagnostic output should use mtaLog() and mtaLogv(). These two routines ensure that diagnostic output is directed to the same output stream as other diagnostic information generated by the MTA SDK. With one exception, consider a call to mtaLog() as being identical to calling the C run-time library routine printf(). The call arguments for the two routines are identical, including the formatting argument, fmt. The single exception is that, unlike printf(), a call to mtaLog() always produces a single line of output to the channel’s log file. Consequently, do not attempt to write either partial or multiple lines with a single call to mtaLog().
Do not include a terminating line feed or other record terminator in the output. That is, do not put a \n at the end of the formatting string.
A time stamp with a resolution of hundredths of a second prefaces each line of diagnostic output generated with mtaLog(). The time stamp uses the system clock and is reported in the local time zone.
None
char buf[64]; mtaLog("Version: %d.%d-%d", mtaVersionMajor(), mtaVersionMinor(), mtaVersionRevision()); mtaLog("Date/time: %s", mtaDateTime(buf, NULL, sizeof(buf), 0)); mtaLog("Postmaster address: %s", mtaPostmasterAddress(NULL, NULL)); |
The following output is generated by the preceding code example.
12:43:24.62: Version: 6.0-0 12:43:24.62: Date/time: Thu, 01 May 2003 12:43:24 -0700 12:43:24.63: Postmaster address: postman@mailhub.siroe.com |