Commit ee1b4a53 ee1b4a5301e6219462aca51d989532f2217a6ab7 by Sergey Poznyakoff

Improved debugging messages

1 parent b28a03bf
......@@ -84,7 +84,13 @@ numaddr_test (sieve_machine_t mach, list_t args, list_t tags)
int rc;
if (sieve_get_debug_level (mach) & MU_SIEVE_DEBUG_TRACE)
sieve_debug (mach, "NUMADDR\n");
{
sieve_locus_t locus;
sieve_get_locus (mach, &locus);
sieve_debug (mach, "%s:%lu: NUMADDR\n",
locus.source_file,
(unsigned long) locus.source_line);
}
/* Retrieve required arguments: */
/* First argument: list of header names */
......
......@@ -133,6 +133,15 @@ list_test (sieve_machine_t mach, list_t args, list_t tags)
struct header_closure clos;
int result;
if (sieve_get_debug_level (mach) & MU_SIEVE_DEBUG_TRACE)
{
sieve_locus_t locus;
sieve_get_locus (mach, &locus);
sieve_debug (mach, "%s:%lu: LIST\n",
locus.source_file,
(unsigned long) locus.source_line);
}
memset (&clos, 0, sizeof clos);
if (sieve_tag_lookup (tags, "delim", &arg))
clos.delim = arg->v.string;
......
......@@ -294,8 +294,14 @@ spamd_test (sieve_machine_t mach, list_t args, list_t tags)
header_t hdr;
if (sieve_get_debug_level (mach) & MU_SIEVE_DEBUG_TRACE)
sieve_debug (mach, "spamd_test %lu\n",
(u_long) sieve_get_message_num (mach));
{
sieve_locus_t locus;
sieve_get_locus (mach, &locus);
sieve_debug (mach, "%s:%lu: spamd_test %lu\n",
locus.source_file,
(unsigned long) locus.source_line,
(u_long) sieve_get_message_num (mach));
}
if (sieve_tag_lookup (tags, "host", &arg))
host = arg->v.string;
......
......@@ -57,7 +57,13 @@ timestamp_test (sieve_machine_t mach, list_t args, list_t tags)
int rc;
if (sieve_get_debug_level (mach) & MU_SIEVE_DEBUG_TRACE)
sieve_debug (mach, "TIMESTAMP\n");
{
sieve_locus_t locus;
sieve_get_locus (mach, &locus);
sieve_debug (mach, "%s:%lu: TIMESTAMP\n",
locus.source_file,
(unsigned long) locus.source_line);
}
/* Retrieve required arguments: */
/* First argument: header name */
......
......@@ -119,7 +119,9 @@ sieve_test_address (sieve_machine_t mach, list_t args, list_t tags)
size_t count;
if (mach->debug_level & MU_SIEVE_DEBUG_TRACE)
sieve_debug (mach, "ADDRESS\n");
sieve_debug (mach, "%s:%lu: ADDRESS\n",
mach->locus.source_file,
(unsigned long) mach->locus.source_line);
h = sieve_value_get (args, 0);
if (!h)
......@@ -183,7 +185,9 @@ sieve_test_header (sieve_machine_t mach, list_t args, list_t tags)
struct header_closure clos;
if (mach->debug_level & MU_SIEVE_DEBUG_TRACE)
sieve_debug (mach, "HEADER\n");
sieve_debug (mach, "%s:%lu: HEADER\n",
mach->locus.source_file,
(unsigned long) mach->locus.source_line);
h = sieve_value_get (args, 0);
if (!h)
......@@ -268,7 +272,9 @@ sieve_test_envelope (sieve_machine_t mach, list_t args, list_t tags)
size_t count;
if (mach->debug_level & MU_SIEVE_DEBUG_TRACE)
sieve_debug (mach, "HEADER\n");
sieve_debug (mach, "%s:%lu: ENVELOPE\n",
mach->locus.source_file,
(unsigned long) mach->locus.source_line);
h = sieve_value_get (args, 0);
if (!h)
......@@ -322,7 +328,8 @@ int
sieve_test_true (sieve_machine_t mach, list_t args, list_t tags)
{
if (mach->debug_level & MU_SIEVE_DEBUG_TRACE)
sieve_debug (mach, "TRUE\n");
sieve_debug (mach, "%s:%lu: TRUE\n", mach->locus.source_file,
(unsigned long) mach->locus.source_line);
return 1;
}
......@@ -330,7 +337,8 @@ int
sieve_test_false (sieve_machine_t mach, list_t args, list_t tags)
{
if (mach->debug_level & MU_SIEVE_DEBUG_TRACE)
sieve_debug (mach, "FALSE\n");
sieve_debug (mach, "%s:%lu: FALSE\n", mach->locus.source_file,
(unsigned long) mach->locus.source_line);
return 0;
}
......@@ -350,7 +358,8 @@ sieve_test_exists (sieve_machine_t mach, list_t args, list_t tags)
sieve_value_t *val;
if (mach->debug_level & MU_SIEVE_DEBUG_TRACE)
sieve_debug (mach, "EXISTS\n");
sieve_debug (mach, "%s:%lu: EXISTS\n", mach->locus.source_file,
(unsigned long) mach->locus.source_line);
message_get_header (sieve_get_message (mach), &header);
val = sieve_value_get (args, 0);
......