server_log()

int server_log(int priority, char *who, char *fmt, ...)

The way you call this is just like syslog() (see syslog(3) man page), with one twist, there is a "who" 2nd argument, which is similar to what you would pass to openlog() when using syslog as ident.

The addition of who is to allow you to add additional context to the logged message for identification purposes, due to how ServerKit is designed to operate, there may be many modules loaded for a particular personality. Any logging these modules perform should pass their name as the who argument, so any messages they log show useful origin. E.g. a POP3 module logging a successful login would do something like:

server_log(LOG_MAIL | LOG_NOTICE, "pop", "LOGIN user: \"%s\"", session->user);

Like I said, this is important because say there were also an SMTP module loaded in the same personality, they are both executing under the same process but with different contexts, you need to distinguish their logs somehow.



2007-12-06