--- lmtp2nntp_config.c 2002/03/13 13:58:39 1.66
+++ lmtp2nntp_config.c 2002/03/13 14:41:13 1.67
@@ -182,7 +182,7 @@
/* from this point on logging is up and running and fprintf(stderr, ...)
* should not be used in the remainder of the program flow.
*/
- log1(ctx, NOTICE, "startup, version %s", lmtp2nntp_version.v_gnu);
+ logbook(ctx->l2, L2_LEVEL_NOTICE, "startup, version %s", lmtp2nntp_version.v_gnu);
/* --version FLAG */
try {
@@ -192,7 +192,7 @@
|| (ov->ndata == 1 && ov->data.f > 1)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--version = %d", ov->data.f);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--version = %d", ov->data.f);
if (ov->data.f == 1) {
fprintf(stdout, "%s\n", lmtp2nntp_version.v_gnu);
@@ -209,11 +209,11 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--childsmax = \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--childsmax = \"%s\"", ov->data.s);
if (ov->ndata == 1)
if ((ctx->option_childsmax = atoi(ov->data.s)) <= 0) {
- log1(ctx, ERROR, "option --childsmax, number (%d) out of range", ctx->option_childsmax);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --childsmax, number (%d) out of range", ctx->option_childsmax);
throw(0,0,0);
}
}
@@ -229,7 +229,7 @@
|| (ov->ndata == 1 && ov->data.f > 1)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--daemonize = %d", ov->data.f);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--daemonize = %d", ov->data.f);
ctx->option_daemon = ov->data.f == 1 ? TRUE : FALSE;
}
@@ -244,7 +244,7 @@
|| (ov->ndata == 1 && ov->data.f > 1)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--kill = %d", ov->data.f);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--kill = %d", ov->data.f);
ctx->option_killflag = ov->data.f == 1 ? TRUE : FALSE;
}
@@ -258,7 +258,7 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--pidfile = \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--pidfile = \"%s\"", ov->data.s);
if (ov->ndata == 1)
ctx->option_pidfile = ov->data.s;
@@ -276,9 +276,9 @@
|| (ov->ndata < 0)
|| (ov->ndata >= 1 && ov->data.m == NULL)
) throw(0,0,0);
- log1(ctx, DEBUG, "ov->ndata = %d", ov->ndata);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "ov->ndata = %d", ov->ndata);
for (i = 0; i < ov->ndata; i++)
- log2(ctx, TRACE, "--acl[%d] = \"%s\"", i, (ov->data.m)[i]);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--acl[%d] = \"%s\"", i, (ov->data.m)[i]);
/* check if only blocking ACLs exist */
somepass = FALSE;
@@ -298,7 +298,7 @@
if (ov->ndata >= 1) {
for (i = 0; i < ov->ndata; i++) {
cp = (ov->data.m)[i];
- log2(ctx, DEBUG, "cp = (data.m)[%d] = \"%s\"", i, cp);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "cp = (data.m)[%d] = \"%s\"", i, cp);
if (cp[0] == '!') {
ctx->pacl[i].acl = strdup(cp + 1);
ctx->pacl[i].not = TRUE;
@@ -307,20 +307,20 @@
ctx->pacl[i].acl = strdup(cp);
ctx->pacl[i].not = FALSE;
}
- log2(ctx, DEBUG, "ctx->pacl[%d].not = %s", i, ctx->pacl[i].not == TRUE ? "TRUE" : "FALSE");
- log2(ctx, DEBUG, "ctx->pacl[%d].acl = %s", i, ctx->pacl[i].acl);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "ctx->pacl[%d].not = %s", i, ctx->pacl[i].not == TRUE ? "TRUE" : "FALSE");
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "ctx->pacl[%d].acl = %s", i, ctx->pacl[i].acl);
if ((cp = strrchr(ctx->pacl[i].acl, '/')) != NULL)
*cp++ = NUL;
else
cp = "-1";
ctx->pacl[i].prefixlen = atoi(cp);
- log2(ctx, DEBUG, "ctx->pacl[%d].prefixlen = %d", i, ctx->pacl[i].prefixlen);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "ctx->pacl[%d].prefixlen = %d", i, ctx->pacl[i].prefixlen);
if ((rc = sa_addr_create(&(ctx->pacl[i].saa))) != SA_OK) {
- log1(ctx, ERROR, "option --acl, create address (internal) failed with \"%s\"", sa_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --acl, create address (internal) failed with \"%s\"", sa_error(rc));
throw(0,0,0);
}
if ((rc = sa_addr_u2a(ctx->pacl[i].saa, "inet://%s:0", ctx->pacl[i].acl)) != SA_OK) {
- log2(ctx, ERROR, "option --acl, parsing address (%s) failed with \"%s\"", ctx->pacl[i].acl, sa_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --acl, parsing address (%s) failed with \"%s\"", ctx->pacl[i].acl, sa_error(rc));
throw(0,0,0);
}
}
@@ -334,11 +334,11 @@
ctx->pacl[i].not = FALSE;
ctx->pacl[i].prefixlen = 0;
if ((rc = sa_addr_create(&ctx->pacl[i].saa)) != SA_OK) {
- log1(ctx, ERROR, "option --acl, create IPv4 pass-through address (internal) failed with \"%s\"", sa_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --acl, create IPv4 pass-through address (internal) failed with \"%s\"", sa_error(rc));
throw(0,0,0);
}
if ((rc = sa_addr_u2a(ctx->pacl[i].saa, "inet://%s:0", ctx->pacl[i].acl)) != SA_OK) {
- log2(ctx, ERROR, "option --acl, parsing IPv4 pass-through address (%s) failed with \"%s\"", ctx->pacl[i].acl, sa_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --acl, parsing IPv4 pass-through address (%s) failed with \"%s\"", ctx->pacl[i].acl, sa_error(rc));
throw(0,0,0);
}
i++;
@@ -352,11 +352,11 @@
ctx->pacl[i].not = FALSE;
ctx->pacl[i].prefixlen = 0;
if ((rc = sa_addr_create(&ctx->pacl[i].saa)) != SA_OK) {
- log1(ctx, ERROR, "option --acl, create IPv6 pass-through address (internal) failed with \"%s\"", sa_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --acl, create IPv6 pass-through address (internal) failed with \"%s\"", sa_error(rc));
throw(0,0,0);
}
if ((rc = sa_addr_u2a(ctx->pacl[i].saa, "inet://%s:0", ctx->pacl[i].acl)) != SA_OK) {
- log2(ctx, ERROR, "option --acl, parsing IPv6 pass-through address (%s) failed with \"%s\"", ctx->pacl[i].acl, sa_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --acl, parsing IPv6 pass-through address (%s) failed with \"%s\"", ctx->pacl[i].acl, sa_error(rc));
throw(0,0,0);
}
i++;
@@ -373,17 +373,17 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--bind = \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--bind = \"%s\"", ov->data.s);
if (ov->ndata == 1) {
/* dash means stdio */
if (strcmp(ov->data.s, "-") != 0) {
if ((rc = sa_create(&ctx->saServerbind)) != SA_OK) {
- log1(ctx, ERROR, "option --bind, creating TCP socket (internal) failed with \"%s\"", sa_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --bind, creating TCP socket (internal) failed with \"%s\"", sa_error(rc));
throw(0,0,0);
}
if ((rc = sa_addr_create(&ctx->saaServerbind)) != SA_OK) {
- log1(ctx, ERROR, "option --bind, create address (internal) failed with \"%s\"", sa_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --bind, create address (internal) failed with \"%s\"", sa_error(rc));
throw(0,0,0);
}
/* slash means UNIX socket */
@@ -413,27 +413,27 @@
nPerm = ((nPerm << 3) | n);
}
if (nPerm == -1 || cpPerm[i] != '\0') {
- log1(ctx, ERROR, "option --bind, invalid permissions \"%s\"", cpPerm);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --bind, invalid permissions \"%s\"", cpPerm);
throw(0,0,0);
}
}
if ((rc = sa_addr_u2a(ctx->saaServerbind, "unix:%s", cpPath)) != SA_OK) {
- log2(ctx, ERROR, "option --bind, parsing alternate IO guessing UNIX socket (%s) failed with \"%s\"", cpPath, sa_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --bind, parsing alternate IO guessing UNIX socket (%s) failed with \"%s\"", cpPath, sa_error(rc));
throw(0,0,0);
}
if ((rc = sa_bind(ctx->saServerbind, ctx->saaServerbind)) != SA_OK) {
- log2(ctx, ERROR, "option --bind, bind (%s) failed with \"%s\"", cpPath, sa_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --bind, bind (%s) failed with \"%s\"", cpPath, sa_error(rc));
throw(0,0,0);
}
if (nPerm != -1) {
if (chmod(cpPath, nPerm) == -1) {
- log3(ctx, ERROR, "option --bind, chmod (%s, 0%o) failed with \"%s\"", cpPath, nPerm, strerror(errno));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --bind, chmod (%s, 0%o) failed with \"%s\"", cpPath, nPerm, strerror(errno));
throw(0,0,0);
}
}
if (getuid() == 0 && getuid() != ctx->option_uid) {
if (chown(cpPath, ctx->option_uid, -1) == -1) {
- log3(ctx, ERROR, "option --bind, chown (%s, %d) failed with \"%s\"", cpPath, ctx->option_uid, strerror(errno));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --bind, chown (%s, %d) failed with \"%s\"", cpPath, ctx->option_uid, strerror(errno));
throw(0,0,0);
}
}
@@ -442,17 +442,17 @@
/* otherwise assume INET socket */
else {
if ((rc = sa_addr_u2a(ctx->saaServerbind, "inet://%s", ov->data.s)) != SA_OK) {
- log2(ctx, ERROR, "option --bind, parsing alternate IO guessing INET socket (%s) failed with \"%s\"", ov->data.s, sa_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --bind, parsing alternate IO guessing INET socket (%s) failed with \"%s\"", ov->data.s, sa_error(rc));
throw(0,0,0);
}
if ((rc = sa_bind(ctx->saServerbind, ctx->saaServerbind)) != SA_OK) {
- log2(ctx, ERROR, "option --bind, bind (%s) failed with \"%s\"", ov->data.s, sa_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --bind, bind (%s) failed with \"%s\"", ov->data.s, sa_error(rc));
throw(0,0,0);
}
}
/* for either sockets */
if ((rc = sa_listen(ctx->saServerbind, -1)) != SA_OK) {
- log2(ctx, ERROR, "option --bind, listen (%s) failed with \"%s\"", ov->data.s, sa_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --bind, listen (%s) failed with \"%s\"", ov->data.s, sa_error(rc));
throw(0,0,0);
}
}
@@ -468,17 +468,17 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--client = \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--client = \"%s\"", ov->data.s);
if (ov->ndata == 1) {
if ((rc = sa_addr_create(&ctx->saaClientbind)) != SA_OK) {
- log1(ctx, ERROR, "option --client, create address (internal) failed with \"%s\"", sa_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --client, create address (internal) failed with \"%s\"", sa_error(rc));
throw(0,0,0);
}
if ((rc = sa_addr_u2a(ctx->saaClientbind,
(strchr(ov->data.s, ':') == NULL) ? "inet://%s:0" : "inet://%s",
ov->data.s)) != SA_OK) {
- log2(ctx, ERROR, "option --client, parsing alternate IO guessing INET socket (%s) failed with \"%s\"", ov->data.s, sa_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --client, parsing alternate IO guessing INET socket (%s) failed with \"%s\"", ov->data.s, sa_error(rc));
throw(0,0,0);
}
}
@@ -495,29 +495,29 @@
|| (ov->ndata < 0)
|| (ov->ndata >= 1 && ov->data.m == NULL)
) throw(0,0,0);
- log1(ctx, DEBUG, "ov->ndata = %d", ov->ndata);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "ov->ndata = %d", ov->ndata);
for (i = 0; i < ov->ndata; i++)
- log2(ctx, TRACE, "--destination[%d] = \"%s\"", i, (ov->data.m)[i]);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--destination[%d] = \"%s\"", i, (ov->data.m)[i]);
if (ov->ndata >= 1) {
if ((ctx->pns = (struct ns *)malloc(ov->ndata * sizeof(struct ns))) == NULL) throw(0,0,0);
for (i = 0; i < ov->ndata;) {
cp = (ov->data.m)[i];
- log2(ctx, DEBUG, "cp = (data.m)[%d] = \"%s\"", i, cp);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "cp = (data.m)[%d] = \"%s\"", i, cp);
if (strrchr(cp, ':') == NULL)
cp = str_concat(cp, ":nntp", NULL); //FIXME is this a config var/val?
else
cp = str_concat(cp, NULL); /* prepare for free() */
if ((rc = sa_addr_create(&ctx->pns[i].saa)) != SA_OK) {
- log1(ctx, ERROR, "option --destination, create address (internal) failed with \"%s\"", sa_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --destination, create address (internal) failed with \"%s\"", sa_error(rc));
throw(0,0,0);
}
if ((rc = sa_addr_u2a(ctx->pns[i].saa, "inet://%s", cp)) != SA_OK) {
- log2(ctx, ERROR, "option --destination, parsing host address (%s) failed with \"%s\"", cp /*FIXME again, option vs. config */, sa_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --destination, parsing host address (%s) failed with \"%s\"", cp /*FIXME again, option vs. config */, sa_error(rc));
throw(0,0,0);
}
if ((rc = sa_create(&ctx->pns[i].sa)) != SA_OK) {
- log2(ctx, ERROR, "option --destination, creating TCP socket (%s) failed with \"%s\"", cp /*FIXME again, option vs. config */, sa_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --destination, creating TCP socket (%s) failed with \"%s\"", cp /*FIXME again, option vs. config */, sa_error(rc));
throw(0,0,0);
}
ctx->pns[i].nntp = NULL;
@@ -538,7 +538,7 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--groupmode = \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--groupmode = \"%s\"", ov->data.s);
if (ov->ndata == 1) {
if (strcasecmp(ov->data.s, "arg") == 0)
@@ -548,7 +548,7 @@
else if (strcasecmp(ov->data.s, "header") == 0)
ctx->option_groupmode = GROUPMODE_HEADER;
else {
- log1(ctx, ERROR, "option --groupmode, invalid mode (%s)", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --groupmode, invalid mode (%s)", ov->data.s);
throw(0,0,0);
}
}
@@ -572,14 +572,14 @@
|| (ov->ndata < 0)
|| (ov->ndata >= 1 && ov->data.m == NULL)
) throw(0,0,0);
- log1(ctx, DEBUG, "ov->ndata = %d", ov->ndata);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "ov->ndata = %d", ov->ndata);
for (i = 0; i < ov->ndata; i++)
- log2(ctx, TRACE, "--headerule[%d] = \"%s\"", i, (ov->data.m)[i]);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--headerule[%d] = \"%s\"", i, (ov->data.m)[i]);
if (ov->ndata >= 1) {
for (i = 0; i < ov->ndata; i++) {
cp = (ov->data.m)[i];
- log2(ctx, DEBUG, "cp = (data.m)[%d] = \"%s\"", i, cp);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "cp = (data.m)[%d] = \"%s\"", i, cp);
hrNew = (headerrule_t *)mallocex(sizeof(headerrule_t));
hrNew->next = NULL;
@@ -593,7 +593,7 @@
/* priority */
cpP = cp;
if ((cp = strchr(cp, ':')) == NULL) {
- log1(ctx, ERROR, "option --headerrule, priority (%s) terminating colon missing", (ov->data.m)[i]);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --headerrule, priority (%s) terminating colon missing", (ov->data.m)[i]);
throw(0,0,0);
}
cp++;
@@ -603,7 +603,7 @@
/* regex */
cpP = cp;
if ((cp = strchr(cp, ':')) == NULL) {
- log1(ctx, ERROR, "option --headerrule, regex (%s) terminating colon missing", (ov->data.m)[i]);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --headerrule, regex (%s) terminating colon missing", (ov->data.m)[i]);
throw(0,0,0);
}
cp++;
@@ -613,13 +613,13 @@
/* header */
cpP = cp;
if ((cp = strchr(cp, ':')) == NULL) {
- log1(ctx, ERROR, "option --headerrule, header (%s) terminating colon missing", (ov->data.m)[i]);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --headerrule, header (%s) terminating colon missing", (ov->data.m)[i]);
throw(0,0,0);
}
cp++;
n = cp - cpP;
if (n == 0) {
- log1(ctx, ERROR, "option --headerrule, header (%s) missing", (ov->data.m)[i]);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --headerrule, header (%s) missing", (ov->data.m)[i]);
throw(0,0,0);
}
hrNew->header = str_dupex(cpP, n);
@@ -632,12 +632,12 @@
if (hrNew->regex != NULL) {
/* compile regular expression into finite state machine and optimize */
if ((hrNew->pcreRegex = pcre_compile(hrNew->regex, PCRE_CASELESS, &cpError, &iError, NULL)) == NULL) {
- log3(ctx, ERROR, "option --headerrule, regex (%s) failed at pos %d with %s", hrNew->regex, iError, cpError);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --headerrule, regex (%s) failed at pos %d with %s", hrNew->regex, iError, cpError);
throw(0,0,0);
}
hrNew->pcreExtra = pcre_study(hrNew->pcreRegex, 0, &cpError);
if (cpError != NULL) {
- log1(ctx, ERROR, "option --headerrule, regex optimization failed with %s", cpError);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --headerrule, regex optimization failed with %s", cpError);
throw(0,0,0);
}
}
@@ -662,11 +662,11 @@
var_rc_t rc;
if ((rc = var_create(&ctx->config_varregex)) != VAR_OK) {
- log2(ctx, ERROR, "option --headerrule, create regex context failed with %s (%d)", var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --headerrule, create regex context failed with %s (%d)", var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
throw(0,0,0);
}
if ((rc = var_config(ctx->config_varregex, VAR_CONFIG_SYNTAX, &syntax_regex)) != VAR_OK) {
- log2(ctx, ERROR, "option --headerrule, config regex context failed with %s (%d)", var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --headerrule, config regex context failed with %s (%d)", var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
throw(0,0,0);
}
}
@@ -700,7 +700,7 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--mailfrom = \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--mailfrom = \"%s\"", ov->data.s);
if (ov->ndata == 1) {
ctx->option_mailfrom = strdup(ov->data.s);
@@ -714,7 +714,7 @@
ctx->option_mailfrom = cp;
}
if (str_parse("<>", ctx->option_mailfrom) == -1) {
- log1(ctx, ERROR, "option --mailfrom, illegal regex (%s)", ctx->option_mailfrom);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --mailfrom, illegal regex (%s)", ctx->option_mailfrom);
throw(0,0,0);
}
}
@@ -729,11 +729,11 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--nodename = \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--nodename = \"%s\"", ov->data.s);
if (ov->ndata == 1) {
if (strlen(ov->data.s) > sizeof(ctx->uname.nodename)-1) {
- log1(ctx, ERROR, "option --nodename, name (%s) too long", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --nodename, name (%s) too long", ov->data.s);
throw(0,0,0);
}
strcpy(ctx->uname.nodename, ov->data.s);
@@ -751,7 +751,7 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--operationmode = \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--operationmode = \"%s\"", ov->data.s);
if (ov->ndata == 1) {
cp = strdup(ov->data.s);
@@ -762,11 +762,11 @@
else {
ctx->option_operationmode = OPERATIONMODE_FAKE;
if (strlen(cp) != 9) {
- log1(ctx, ERROR, "option --operationmode, invalid length (%s)", cp);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --operationmode, invalid length (%s)", cp);
throw(0,0,0);
}
if (cp[3] != '/') {
- log1(ctx, ERROR, "option --operationmode, missing slash (%s)", cp);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --operationmode, missing slash (%s)", cp);
throw(0,0,0);
}
cp[3] = NUL;
@@ -777,7 +777,7 @@
|| !isdigit((int)ctx->option_operationmodefakestatus[1])
|| !isdigit((int)ctx->option_operationmodefakestatus[2])
) {
- log1(ctx, ERROR, "option --operationmode, invalid status code (%s)", cp);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --operationmode, invalid status code (%s)", cp);
throw(0,0,0);
}
if ( (strlen(ctx->option_operationmodefakedsn) != 5)
@@ -788,13 +788,13 @@
|| !isdigit((int)ctx->option_operationmodefakedsn[4])
|| (ctx->option_operationmodefakedsn[0] != ctx->option_operationmodefakestatus[0])
) {
- log1(ctx, ERROR, "option --operationmode, invalid dsn code (%s)", cp);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --operationmode, invalid dsn code (%s)", cp);
throw(0,0,0);
}
}
}
else {
- log0(ctx, ERROR, "option --operationmode, is mandatory but neither given nor preset (internal)");
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --operationmode, is mandatory but neither given nor preset (internal)");
throw(0,0,0);
}
}
@@ -810,7 +810,7 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--restrictheader = \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--restrictheader = \"%s\"", ov->data.s);
if (ov->ndata == 1) {
ctx->option_restrictheader = strdup(ov->data.s);
@@ -824,7 +824,7 @@
ctx->option_restrictheader = cp;
}
if (str_parse("<>", ctx->option_restrictheader) == -1) {
- log1(ctx, ERROR, "option --restrictheader, illegal regex (%s)", ctx->option_restrictheader);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --restrictheader, illegal regex (%s)", ctx->option_restrictheader);
throw(0,0,0);
}
}
@@ -839,11 +839,11 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--size = \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--size = \"%s\"", ov->data.s);
if (ov->ndata == 1)
if ((ctx->option_maxmessagesize = atoi(ov->data.s)) <= 0) {
- log1(ctx, ERROR, "option --size, number (%d) out of range", ctx->option_maxmessagesize);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --size, number (%d) out of range", ctx->option_maxmessagesize);
throw(0,0,0);
}
}
@@ -859,11 +859,11 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--timeoutlmtp= \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--timeoutlmtp= \"%s\"", ov->data.s);
if (ov->ndata == 1) {
if ((i = atoi(ov->data.s)) < 0) {
- log1(ctx, ERROR, "option --timeoutlmtp, number (%d) out of range", i);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --timeoutlmtp, number (%d) out of range", i);
throw(0,0,0);
}
ctx->option_timeout_lmtp_accept = i;
@@ -881,11 +881,11 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--timeoutlmtpaccept = \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--timeoutlmtpaccept = \"%s\"", ov->data.s);
if (ov->ndata == 1)
if ((ctx->option_timeout_lmtp_accept = atoi(ov->data.s)) < 0) {
- log1(ctx, ERROR, "option --timeoutlmtpaccept, number (%d) out of range", ctx->option_timeout_lmtp_accept);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --timeoutlmtpaccept, number (%d) out of range", ctx->option_timeout_lmtp_accept);
throw(0,0,0);
}
}
@@ -899,11 +899,11 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--timeoutlmtpread = \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--timeoutlmtpread = \"%s\"", ov->data.s);
if (ov->ndata == 1)
if ((ctx->option_timeout_lmtp_read = atoi(ov->data.s)) < 0) {
- log1(ctx, ERROR, "option --timeoutlmtpread, number (%d) out of range", ctx->option_timeout_lmtp_read);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --timeoutlmtpread, number (%d) out of range", ctx->option_timeout_lmtp_read);
throw(0,0,0);
}
}
@@ -917,11 +917,11 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--timeoutlmtpwrite = \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--timeoutlmtpwrite = \"%s\"", ov->data.s);
if (ov->ndata == 1)
if ((ctx->option_timeout_lmtp_write = atoi(ov->data.s)) < 0) {
- log1(ctx, ERROR, "option --timeoutlmtpwrite, number (%d) out of range", ctx->option_timeout_lmtp_write);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --timeoutlmtpwrite, number (%d) out of range", ctx->option_timeout_lmtp_write);
throw(0,0,0);
}
}
@@ -937,11 +937,11 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--timeoutnntp= \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--timeoutnntp= \"%s\"", ov->data.s);
if (ov->ndata == 1) {
if ((i = atoi(ov->data.s)) < 0) {
- log1(ctx, ERROR, "option --timeoutnntp, number (%d) out of range", i);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --timeoutnntp, number (%d) out of range", i);
throw(0,0,0);
}
ctx->option_timeout_nntp_connect = i;
@@ -959,11 +959,11 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--timeoutnntpconnect = \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--timeoutnntpconnect = \"%s\"", ov->data.s);
if (ov->ndata == 1)
if ((ctx->option_timeout_nntp_connect = atoi(ov->data.s)) < 0) {
- log1(ctx, ERROR, "option --timeoutnntpconnect, number (%d) out of range", ctx->option_timeout_nntp_connect);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --timeoutnntpconnect, number (%d) out of range", ctx->option_timeout_nntp_connect);
throw(0,0,0);
}
}
@@ -977,11 +977,11 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--timeoutnntpread = \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--timeoutnntpread = \"%s\"", ov->data.s);
if (ov->ndata == 1)
if ((ctx->option_timeout_nntp_read = atoi(ov->data.s)) < 0) {
- log1(ctx, ERROR, "option --timeoutnntpread, number (%d) out of range", ctx->option_timeout_nntp_read);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --timeoutnntpread, number (%d) out of range", ctx->option_timeout_nntp_read);
throw(0,0,0);
}
}
@@ -995,11 +995,11 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--timeoutnntpwrite = \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--timeoutnntpwrite = \"%s\"", ov->data.s);
if (ov->ndata == 1)
if ((ctx->option_timeout_nntp_write = atoi(ov->data.s)) < 0) {
- log1(ctx, ERROR, "option --timeoutnntpwrite, number (%d) out of range", ctx->option_timeout_nntp_write);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --timeoutnntpwrite, number (%d) out of range", ctx->option_timeout_nntp_write);
throw(0,0,0);
}
}
@@ -1015,18 +1015,18 @@
|| (ov->ndata == 1 && ov->data.s == NULL)
|| (ov->ndata > 1)
) throw(0,0,0);
- log1(ctx, TRACE, "--user = \"%s\"", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--user = \"%s\"", ov->data.s);
if (ov->ndata == 1) {
if (isdigit((int)ov->data.s[0])) {
if ((sPasswd = getpwuid((uid_t)atoi(ov->data.s))) == NULL) {
- log1(ctx, ERROR, "option --user, uid (%s) not found", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --user, uid (%s) not found", ov->data.s);
throw(0,0,0);
}
}
else {
if ((sPasswd = getpwnam(ov->data.s)) == NULL) {
- log1(ctx, ERROR, "option --user, name (%s) not found", ov->data.s);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "option --user, name (%s) not found", ov->data.s);
throw(0,0,0);
}
}
@@ -1045,14 +1045,14 @@
|| (ov->ndata < 0)
|| (ov->ndata >= 1 && ov->data.m == NULL)
) throw(0,0,0);
- log1(ctx, DEBUG, "ov->ndata = %d", ov->ndata);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "ov->ndata = %d", ov->ndata);
for (i = 0; i < ov->ndata; i++)
- log2(ctx, TRACE, "--newsgroup[%d] = \"%s\"", i, (ov->data.m)[i]);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--newsgroup[%d] = \"%s\"", i, (ov->data.m)[i]);
if (ov->ndata >= 1) {
for (i = 0; i < ov->ndata; i++) {
cp = (ov->data.m)[i];
- log2(ctx, DEBUG, "cp = (data.m)[%d] = \"%s\"", i, cp);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "cp = (data.m)[%d] = \"%s\"", i, cp);
argz_add(&ctx->azGroupargs, &ctx->asGroupargs, cp);
}
}
@@ -1070,14 +1070,14 @@
|| (ov->ndata < 0)
|| (ov->ndata >= 1 && ov->data.m == NULL)
) throw(0,0,0);
- log1(ctx, DEBUG, "ov->ndata = %d", ov->ndata);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "ov->ndata = %d", ov->ndata);
for (i = 0; i < ov->ndata; i++)
- log2(ctx, TRACE, "--testfile[%d] = \"%s\"", i, (ov->data.m)[i]);
+ logbook(ctx->l2, L2_LEVEL_TRACE, "--testfile[%d] = \"%s\"", i, (ov->data.m)[i]);
if (ov->ndata >= 1) {
for (i = 0; i < ov->ndata; i++) {
cp = (ov->data.m)[i];
- log2(ctx, DEBUG, "cp = (data.m)[%d] = \"%s\"", i, cp);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "cp = (data.m)[%d] = \"%s\"", i, cp);
{
const char *filename = cp;
struct stat sb;
@@ -1109,17 +1109,17 @@
msg->l2 = ctx->l2;
msg->cpMsg = cpBuf;
if ((rc = msg_split((msg_t *)msg)) != MSG_OK) {
- log1(ctx, ERROR, "Error splitting message: %s", msg_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "Error splitting message: %s", msg_error(rc));
throw(0, 0, "msg_split");
}
{//FIXME
char *cp;
cp = NULL;
- log0(msg, DEBUG, "FIXME trace #20");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "FIXME trace #20");
while ((cp = argz_next(msg->azHeaders, msg->asHeaders, cp)) != NULL) {
- log1(msg, DEBUG, "header=\"%s\"", cp);
+ logbook(msg->l2, L2_LEVEL_DEBUG, "header=\"%s\"", cp);
}
- log0(msg, DEBUG, "FIXME trace #21");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "FIXME trace #21");
}
msg_headermatrixbuildup((msg_t *)msg);
ctx->msg = (msg_t *)msg;
@@ -1128,15 +1128,15 @@
{//FIXME
char *cp;
cp = NULL;
- log0(msg, DEBUG, "FIXME trace #30");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "FIXME trace #30");
while ((cp = argz_next(msg->azHeaders, msg->asHeaders, cp)) != NULL) {
- log1(msg, DEBUG, "header=\"%s\"", cp);
+ logbook(msg->l2, L2_LEVEL_DEBUG, "header=\"%s\"", cp);
}
- log0(msg, DEBUG, "FIXME trace #31");
+ logbook(msg->l2, L2_LEVEL_DEBUG, "FIXME trace #31");
}
argz_add(&((msg_t *)msg)->azNewsgroups, &((msg_t *)msg)->asNewsgroups, "invalid.tst"); //FIXME
if ((rc = msg_join((msg_t *)msg)) != MSG_OK) {
- log1(ctx, ERROR, "Error joining message: %s", msg_error(rc));
+ logbook(ctx->l2, L2_LEVEL_ERROR, "Error joining message: %s", msg_error(rc));
throw(0, 0, "msg_split");
}
printf("%s", msg->cpMsg); //FIXME
@@ -1246,7 +1246,7 @@
char *cp;
int i;
- log2(ctx, DEBUG, "rgx_lookup variable \"%s\" (%d)", var_ptr, var_len);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "rgx_lookup variable \"%s\" (%d)", var_ptr, var_len);
rc = VAR_ERR_UNDEFINED_VARIABLE;
i = atoi(var_ptr); /* works with both '}' and '\0' termination */
if (i < ctx->nMatch) {
@@ -1256,9 +1256,9 @@
rc = VAR_OK;
}
if (rc == VAR_OK)
- log4(ctx, DEBUG, "rgx_lookup variable \"%s\" (%d) ok: result is \"%s\" (%d)", var_ptr, var_len, *val_ptr, *val_len);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "rgx_lookup variable \"%s\" (%d) ok: result is \"%s\" (%d)", var_ptr, var_len, *val_ptr, *val_len);
else
- log4(ctx, DEBUG, "rgx_lookup variable \"%s\" (%d) failed: %s (%d)", var_ptr, var_len, var_strerror(var, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "rgx_lookup variable \"%s\" (%d) failed: %s (%d)", var_ptr, var_len, var_strerror(var, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
return rc;
}
@@ -1294,14 +1294,14 @@
}
cp = argz_next(msg->azHeaders, msg->asHeaders, cp);
if (hdI->ndata == 0) {
- log1(msg, DEBUG, "header=%s, currently empty", hdI->name);
+ logbook(msg->l2, L2_LEVEL_DEBUG, "header=%s, currently empty", hdI->name);
hdI->data.s = strdupex(cp);
hdI->ndata = 1;
}
else if(hdI->ndata == 1) {
char *cpOld;
cpOld = hdI->data.s;
- log1(msg, DEBUG, "header=%s, currently single valued", hdI->name);
+ logbook(msg->l2, L2_LEVEL_DEBUG, "header=%s, currently single valued", hdI->name);
hdI->data.m = (char **)mallocex(3 * sizeof(char *));
hdI->data.m[0] = strdupex(cpOld); //FIXME
hdI->data.m[1] = strdupex(cp);
@@ -1309,7 +1309,7 @@
hdI->ndata = 2;
}
else {
- log2(msg, DEBUG, "header=%s, currently multi valued %d", hdI->name, hdI->ndata);
+ logbook(msg->l2, L2_LEVEL_DEBUG, "header=%s, currently multi valued %d", hdI->name, hdI->ndata);
hdI->data.m = (char **)reallocex(hdI->data.m, (hdI->ndata + 2) * sizeof(char *));
hdI->data.m[hdI->ndata++] = strdupex(cp);
hdI->data.m[hdI->ndata] = NULL;
@@ -1337,21 +1337,21 @@
msg->asHeaders = 0;
for (hdI = msg->hdFirst; hdI != NULL; hdI = hdI->next) { /* for each matrix header */
- log2(msg, DEBUG, "FIXME trace loop hdI=%.8lx, hI->name=\"%s\"", hdI, hdI->name);
+ logbook(msg->l2, L2_LEVEL_DEBUG, "FIXME trace loop hdI=%.8lx, hI->name=\"%s\"", hdI, hdI->name);
if (hdI->name == NULL || strlen(hdI->name) == 0 || hdI->ndata == 0)
continue;
if (hdI->ndata == 0) {
- log1(msg, DEBUG, "header=%s, no data", hdI->name);
+ logbook(msg->l2, L2_LEVEL_DEBUG, "header=%s, no data", hdI->name);
}
else if(hdI->ndata == 1) { /* header data is single valued */
- log2(msg, DEBUG, "header=%s, data=%s", hdI->name, hdI->data.s);
+ logbook(msg->l2, L2_LEVEL_DEBUG, "header=%s, data=%s", hdI->name, hdI->data.s);
argz_add(&msg->azHeaders, &msg->asHeaders, hdI->name);
argz_add(&msg->azHeaders, &msg->asHeaders, hdI->data.s);
}
else { /* header data is multi valued */
int i;
for (i = 0; i < hdI->ndata; i++) {
- log3(msg, DEBUG, "header=%s[%d], data=%s", hdI->name, i, hdI->data.m[i]);
+ logbook(msg->l2, L2_LEVEL_DEBUG, "header=%s[%d], data=%s", hdI->name, i, hdI->data.m[i]);
argz_add(&msg->azHeaders, &msg->asHeaders, hdI->name);
argz_add(&msg->azHeaders, &msg->asHeaders, hdI->data.m[i]);
}
@@ -1381,17 +1381,17 @@
headerrule_t *hrD;
headerdata_t *hdD;
- log0(ctx, DEBUG, "FIXME trace ---------- headerrewrite() ----------");
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "FIXME trace ---------- headerrewrite() ----------");
for (hrD = ctx->option_firstheaderrule; hrD != NULL; hrD = hrD->next)
- log1(ctx, DEBUG, "hrD->header=%s", hrD->header);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "hrD->header=%s", hrD->header);
for (hdD = ctx->msg->hdFirst; hdD != NULL; hdD = hdD->next) {
if (hdD->ndata == 0)
- log1(ctx, DEBUG, "hdD->name=%s: (NO DATA)", hdD->name);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "hdD->name=%s: (NO DATA)", hdD->name);
if (hdD->ndata == 1)
- log2(ctx, DEBUG, "hdD->name:hdD->data.s %s %s", hdD->name, hdD->data.s);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "hdD->name:hdD->data.s %s %s", hdD->name, hdD->data.s);
if (hdD->ndata > 1)
for (i = 0; i < hdD->ndata; i++)
- log3(ctx, DEBUG, "hdD->name:hdD->data.m[%d] %s %s", i, hdD->name, hdD->data.m[i]);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "hdD->name:hdD->data.m[%d] %s %s", i, hdD->name, hdD->data.m[i]);
}
}
@@ -1401,7 +1401,7 @@
regex_ctx->l2_env = ctx->l2_env;
regex_ctx->l2 = ctx->l2;
if ((rc = var_config(ctx->config_varregex, VAR_CONFIG_CB_VALUE, regex_lookup, regex_ctx)) != VAR_OK) {
- log2(ctx, ERROR, "configure regex callback failed with %s (%d)", var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "configure regex callback failed with %s (%d)", var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
throw(0,0,0);
}
for (hrI = ctx->option_firstheaderrule; hrI != NULL; hrI = hrI->next) { /* for each rule */
@@ -1410,22 +1410,22 @@
headerrule_t *hrD;
headerdata_t *hdD;
- log0(ctx, DEBUG, "FIXME trace ---------- headerrewrite() ---------- MIDDLE");
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "FIXME trace ---------- headerrewrite() ---------- MIDDLE");
for (hrD = ctx->option_firstheaderrule; hrD != NULL; hrD = hrD->next)
- log1(ctx, DEBUG, "hrD->header=%s", hrD->header);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "hrD->header=%s", hrD->header);
for (hdD = ctx->msg->hdFirst; hdD != NULL; hdD = hdD->next) {
- //log3(ctx, DEBUG, "hdD=%.8lx, hdD->name=%.8lx, hdD->data.s=%.8lx", (long)hdD, (long)&hdD->name, (long)&hdD->data.s);
+ //logbook(ctx->l2, L2_LEVEL_DEBUG, "hdD=%.8lx, hdD->name=%.8lx, hdD->data.s=%.8lx", (long)hdD, (long)&hdD->name, (long)&hdD->data.s);
if (hdD->ndata == 0)
- log1(ctx, DEBUG, "hdD->name=%s: (NO DATA)", hdD->name);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "hdD->name=%s: (NO DATA)", hdD->name);
if (hdD->ndata == 1)
- log2(ctx, DEBUG, "hdD->name:hdD->data.s %s %s", hdD->name, hdD->data.s);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "hdD->name:hdD->data.s %s %s", hdD->name, hdD->data.s);
if (hdD->ndata > 1)
for (i = 0; i < hdD->ndata; i++)
- log3(ctx, DEBUG, "hdD->name:hdD->data.m[%d] %s %s", i, hdD->name, hdD->data.m[i]);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "hdD->name:hdD->data.m[%d] %s %s", i, hdD->name, hdD->data.m[i]);
}
}
if (hrI->regex != NULL) {
- log1(ctx, DEBUG, "rule has regex %s", hrI->regex);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "rule has regex %s", hrI->regex);
for (hdI = ctx->msg->hdFirst; hdI != NULL; hdI = hdI->next) { /* for each header */
if (hdI->name == NULL || strlen(hdI->name) == 0 || hdI->ndata == 0)
continue;
@@ -1433,23 +1433,23 @@
if (regex_ctx->nMatch >= 1) {
int i;
char *cp;
- log1(ctx, DEBUG, "regex matches, %d references", regex_ctx->nMatch);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "regex matches, %d references", regex_ctx->nMatch);
pcre_get_substring_list(hdI->name, ovec, regex_ctx->nMatch, ®ex_ctx->acpMatch);
if (regex_ctx->acpMatch != NULL)
for (i = 0; i < regex_ctx->nMatch; i++)
- log2(ctx, DEBUG, "regex reference[%d]=\'%s\'", i, regex_ctx->acpMatch[i] == NULL ? "(UNDEFINED)" : regex_ctx->acpMatch[i]);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "regex reference[%d]=\'%s\'", i, regex_ctx->acpMatch[i] == NULL ? "(UNDEFINED)" : regex_ctx->acpMatch[i]);
hdNew = headercreate();
/* expanding regex references into header name */
{
var_rc_t var_rc;
char *res_ptr;
- log1(ctx, DEBUG, "expanding regex references in headername '%s'", hrI->header);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "expanding regex references in headername '%s'", hrI->header);
if ((var_rc = var_expand(ctx->config_varregex, hrI->header, strlen(hrI->header), &res_ptr, NULL, FALSE)) != VAR_OK) {
- log3(ctx, ERROR, "expansion of '%s' failed: %s", hrI->header, var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "expansion of '%s' failed: %s", hrI->header, var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
}
- log1(ctx, DEBUG, "expansion result '%s'", res_ptr);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "expansion result '%s'", res_ptr);
if (strlen(res_ptr) == 0) {
- log0(ctx, DEBUG, "marking deleted - emtpy headername");
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "marking deleted - emtpy headername");
hdNew->name = NULL; //FIXME rename ->header to ->name
/*FIXME clean up data.s and data.m */
hdNew->ndata = 0;
@@ -1459,7 +1459,7 @@
}
}
if (hrI->val == NULL) {
- log0(ctx, DEBUG, "marking deleted - empty headervalue before expansion");
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "marking deleted - empty headervalue before expansion");
/*FIXME clean up data.s and data.m */
hdNew->ndata = 0;
}
@@ -1468,24 +1468,24 @@
{
var_rc_t var_rc;
char *res_ptr;
- log1(ctx, DEBUG, "expanding regex references in header value '%s'", hrI->val);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "expanding regex references in header value '%s'", hrI->val);
if ((var_rc = var_expand(ctx->config_varregex, hrI->val, strlen(hrI->val), &res_ptr, NULL, FALSE)) != VAR_OK) {
- log3(ctx, ERROR, "expansion of '%s' failed: %s", hrI->val, var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "expansion of '%s' failed: %s", hrI->val, var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
}
- log1(ctx, DEBUG, "expansion result '%s'", res_ptr);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "expansion result '%s'", res_ptr);
cp = res_ptr;
}
/* expanding header and other variables into header value */
if (hrI->val != NULL) {
var_rc_t var_rc;
char *res_ptr;
- log1(ctx, DEBUG, "expanding variables in header value '%s'", hrI->val);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "expanding variables in header value '%s'", hrI->val);
if ((var_rc = var_expand(ctx->config_varctx, cp, strlen(cp), &res_ptr, NULL, FALSE)) != VAR_OK) {
- log3(ctx, ERROR, "expansion of '%s' failed: %s", cp, var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "expansion of '%s' failed: %s", cp, var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
}
- log1(ctx, DEBUG, "expansion result '%s'", res_ptr);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "expansion result '%s'", res_ptr);
if (strlen(res_ptr) == 0) {
- log0(ctx, DEBUG, "marking deleted - empty headervalue after expansion");
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "marking deleted - empty headervalue after expansion");
/*FIXME clean up data.s and data.m */
hdNew->ndata = 0;
}
@@ -1504,11 +1504,11 @@
}
}
else {
- log1(ctx, DEBUG, "rule has no regex but static header %s", hrI->header);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "rule has no regex but static header %s", hrI->header);
hdNew = headercreate();
hdNew->name = strdupex(hrI->header); //FIXME rename ->header to ->name
if (hrI->val == NULL) {
- log0(ctx, DEBUG, "marking deleted");
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "marking deleted");
/*FIXME clean up data.s and data.m */
hdNew->ndata = 0;
}
@@ -1517,13 +1517,13 @@
/* expanding header and other variables into header value */
var_rc_t var_rc;
char *res_ptr;
- log1(ctx, DEBUG, "expanding variables in header value '%s'", hrI->val);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "expanding variables in header value '%s'", hrI->val);
if ((var_rc = var_expand(ctx->config_varctx, hrI->val, strlen(hrI->val), &res_ptr, NULL, FALSE)) != VAR_OK) {
- log3(ctx, ERROR, "expansion of '%s' failed: %s", hrI->val, var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
+ logbook(ctx->l2, L2_LEVEL_ERROR, "expansion of '%s' failed: %s", hrI->val, var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
}
- log1(ctx, DEBUG, "expansion result '%s'", res_ptr);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "expansion result '%s'", res_ptr);
if (strlen(res_ptr) == 0) {
- log0(ctx, DEBUG, "marking deleted - empty headervalue after expansion");
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "marking deleted - empty headervalue after expansion");
/*FIXME clean up data.s and data.m */
hdNew->ndata = 0;
}
@@ -1535,20 +1535,20 @@
for (hdI = ctx->msg->hdFirst; hdI != NULL; hdI = hdI->next) { /* for each header */
if (hdI->name == NULL || strlen(hdI->name) == 0)
continue;
- log2(ctx, DEBUG, "hrI->header=%s, hdI->name=%s", hrI->header, hdI->name);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "hrI->header=%s, hdI->name=%s", hrI->header, hdI->name);
if (strcasecmp(hrI->header, hdI->name) == 0)
break;
}
if (hdI != NULL) {
- log1(ctx, DEBUG, "replacing header %s", hrI->header);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "replacing header %s", hrI->header);
headerreplace(hdI, hdNew);
if (hdNew->prev == NULL) {
- log0(ctx, DEBUG, "FIXME trace #1");
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "FIXME trace #1");
ctx->msg->hdFirst = hdNew;
}
}
else {
- log1(ctx, DEBUG, "appending header %s", hrI->header);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "appending header %s", hrI->header);
for (hdI = ctx->msg->hdFirst; hdI->next != NULL; hdI = hdI->next);
hdI->next = hdNew;
hdNew->prev = hdI;
@@ -1561,17 +1561,17 @@
headerrule_t *hrD;
headerdata_t *hdD;
- log0(ctx, DEBUG, "FIXME trace ---------- headerrewrite() ---------- FINISH");
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "FIXME trace ---------- headerrewrite() ---------- FINISH");
for (hrD = ctx->option_firstheaderrule; hrD != NULL; hrD = hrD->next)
- log1(ctx, DEBUG, "hrD->header=%s", hrD->header);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "hrD->header=%s", hrD->header);
for (hdD = ctx->msg->hdFirst; hdD != NULL; hdD = hdD->next) {
if (hdD->ndata == 0)
- log1(ctx, DEBUG, "hdD->name=%s: (NO DATA)", hdD->name);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "hdD->name=%s: (NO DATA)", hdD->name);
if (hdD->ndata == 1)
- log2(ctx, DEBUG, "hdD->name:hdD->data.s %s %s", hdD->name, hdD->data.s);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "hdD->name:hdD->data.s %s %s", hdD->name, hdD->data.s);
if (hdD->ndata > 1)
for (i = 0; i < hdD->ndata; i++)
- log3(ctx, DEBUG, "hdD->name:hdD->data.m[%d] %s %s", i, hdD->name, hdD->data.m[i]);
+ logbook(ctx->l2, L2_LEVEL_DEBUG, "hdD->name:hdD->data.m[%d] %s %s", i, hdD->name, hdD->data.m[i]);
}
}
}
|