Sun Java System Messaging Server 6 2005Q4 MTA Developer's Reference


The following code fragment demonstrates a way to provide a generalization of mtaLog() using mtaLogv().

#include <stdarg.h>

void ourLog(our_context_t *ctx, const char *fmt, ...)
   char new_fmt[10240];
   va_list ap;

    * Genrate a new formatting string that includes as a prefix
    * the value of ctx-\>id then followed by the contents of the
    * supplied formatting string.
   snprintf(new_fmt, sizeof(new_fmt),
            "id=%d; %s", ctx-\>id, fmt);
   va_start(ap, fmt);
   mtaLogv(new_fmt, ap);