diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-05-23 10:28:12 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-05-23 10:28:12 +0300 |
commit | b7fb81d841a26476da18349200dccce86c2de337 (patch) | |
tree | 9d539656ff304742a719be6b755c60b7dc18b3f8 | |
parent | d265dac0bf3d54ac0ef44a0c0b5d4f143f9e491d (diff) | |
download | mailfromd-b7fb81d841a26476da18349200dccce86c2de337.tar.gz mailfromd-b7fb81d841a26476da18349200dccce86c2de337.tar.bz2 |
Add new debugging function.
* mfd/bi_mudebug.m4: New file.
* mfd/Makefile.am (M4_FILES): Add bi_mudebug.m4
* NEWS, doc/mailfromd.texi: Update.
-rw-r--r-- | NEWS | 7 | ||||
-rw-r--r-- | doc/mailfromd.texi | 26 | ||||
-rw-r--r-- | mfd/Makefile.am | 1 | ||||
-rw-r--r-- | mfd/bi_mudebug.m4 | 27 |
4 files changed, 60 insertions, 1 deletions
@@ -1,4 +1,4 @@ -Mailfromd NEWS -- history of user-visible changes. 2009-05-19 +Mailfromd NEWS -- history of user-visible changes. 2009-05-23 Copyright (C) 2005, 2006, 2007, 2008, 2009 Sergey Poznyakoff See the end of file for copying conditions. @@ -37,6 +37,11 @@ m4_ifdef(`WITH_GEOIP',` add "X-Originator-Country" geoip_country_code_by_addr($client_addr) ') +* Debugging + +New function mailutils_set_debug_level allows to set global Mailutils +debug level from your MFL scripts. This is useful for debugging +scripts that use mailbox or message accessing functions. Version 5.1, 2009-05-13 diff --git a/doc/mailfromd.texi b/doc/mailfromd.texi index fe650309..4bbbea9b 100644 --- a/doc/mailfromd.texi +++ b/doc/mailfromd.texi @@ -234,6 +234,7 @@ Built-in and Library Functions * Current Message Functions:: * Mailbox functions:: * Message functions:: +* Debugging functions:: * Quarantine functions:: * Polling functions:: * Internet address manipulation functions:: @@ -5870,6 +5871,7 @@ in version @value{VERSION}. * Current Message Functions:: * Mailbox functions:: * Message functions:: +* Debugging functions:: * Quarantine functions:: * Polling functions:: * Internet address manipulation functions:: @@ -6877,6 +6879,30 @@ contents again. Rewind stream associated with message referred to by descriptor @var{nmsg}. @end deftypefn +@node Debugging functions +@subsubsection Debugging functions + +@deftypefn {Built-in Function} void mailutils_set_debug_level (string level) +Set debug level for the GNU Mailutils library. The @var{level} +argument is a valid debugging level, as described in @ref{Debug +Statement, debugging level, Debug Statement, mailutils, GNU Mailutils +Manual}. + +For example: + +@smallexample + mailutils_set_debug_level("mailbox=trace7") +@end smallexample + +This function always succeeds. If @var{level} is not a valid +Mailutils debugging level, the function issues appropriate diagnostics +using currently established logging channel and returns normally. +@end deftypefn + +This function is useful when debugging @acronym{MFL} scripts that use +mailbox or message functions, described in the previous two +subsections. + @node Quarantine functions @subsubsection Quarantine Functions diff --git a/mfd/Makefile.am b/mfd/Makefile.am index b0fc6f99..126733b0 100644 --- a/mfd/Makefile.am +++ b/mfd/Makefile.am @@ -36,6 +36,7 @@ M4_FILES=\ bi_mail.m4\ bi_mbox.m4\ bi_msg.m4\ + bi_mudebug.m4\ bi_poll.m4\ bi_rcpt.m4\ bi_sa.m4\ diff --git a/mfd/bi_mudebug.m4 b/mfd/bi_mudebug.m4 new file mode 100644 index 00000000..8eeccb79 --- /dev/null +++ b/mfd/bi_mudebug.m4 @@ -0,0 +1,27 @@ +/* This file is part of Mailfromd. -*- c -*- + Copyright (C) 2009 Sergey Poznyakoff + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +MF_DEFUN(mailutils_set_debug_level, VOID, STRING str) +{ + const struct locus *loc = env_get_locus(env); + char *pfx; + asprintf(&pfx, "%s:%lu", loc->file, (unsigned long)loc->line); + mu_global_debug_from_string(str, pfx); + free(pfx); +} +END + +MF_INIT |