summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2007-11-30 11:24:32 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2007-11-30 11:24:32 +0000
commit10a75b15697e10e317c20daf64a34ae683444bc8 (patch)
treea633093e059faa011158be603c96555b9c2d0393
parentcec83dcab0f70d789b977ab53be8d0e391ad11f2 (diff)
downloadmailutils-10a75b15697e10e317c20daf64a34ae683444bc8.tar.gz
mailutils-10a75b15697e10e317c20daf64a34ae683444bc8.tar.bz2
* NEWS, TODO: Update
* include/mailutils/types.hin: New type mu_log_level_t. * include/mailutils/debug.hm4, include/mailutils/diag.h, mailbox/cfg_lexer.c, mailbox/cfg_parser.y, mailbox/dbgstderr.c, mailbox/dbgsyslog.c, mailbox/debug.c, mailbox/diag.c, mailbox/gdebug.c, mailbox/muerror.c, mailbox/syslog.c, sieve/sieve.c: Use mu_log_level_t instead of size_t for debugging and logging levels.
-rw-r--r--ChangeLog11
-rw-r--r--NEWS52
-rw-r--r--TODO22
-rw-r--r--include/mailutils/debug.hm426
-rw-r--r--include/mailutils/diag.h16
-rw-r--r--include/mailutils/types.hin3
-rw-r--r--mailbox/cfg_lexer.c2
-rw-r--r--mailbox/cfg_parser.y2
-rw-r--r--mailbox/dbgstderr.c2
-rw-r--r--mailbox/dbgsyslog.c2
-rw-r--r--mailbox/debug.c16
-rw-r--r--mailbox/diag.c12
-rw-r--r--mailbox/gdebug.c9
-rw-r--r--mailbox/muerror.c2
-rw-r--r--mailbox/syslog.c4
-rw-r--r--sieve/sieve.c2
16 files changed, 117 insertions, 66 deletions
diff --git a/ChangeLog b/ChangeLog
index ec0bb2742..fd76685bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2007-11-30 Sergey Poznyakoff <gray@gnu.org.ua>
+
+ * NEWS, TODO: Update
+ * include/mailutils/types.hin: New type mu_log_level_t.
+ * include/mailutils/debug.hm4, include/mailutils/diag.h,
+ mailbox/cfg_lexer.c, mailbox/cfg_parser.y, mailbox/dbgstderr.c,
+ mailbox/dbgsyslog.c, mailbox/debug.c, mailbox/diag.c,
+ mailbox/gdebug.c, mailbox/muerror.c, mailbox/syslog.c,
+ sieve/sieve.c: Use mu_log_level_t instead of size_t for debugging
+ and logging levels.
+
2007-11-29 Sergey Poznyakoff <gray@gnu.org.ua>
* comsat/action.c, comsat/comsat.c, imap4d/auth_gsasl.c,
diff --git a/NEWS b/NEWS
index cd4125430..b1b53bb95 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU mailutils NEWS -- history of user-visible changes. 2007-11-26
+GNU mailutils NEWS -- history of user-visible changes. 2007-11-30
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
See the end of file for copying conditions.
@@ -9,6 +9,56 @@ Version 1.2.90:
* New configuration file format.
+* Diagnostic and debugging functions essentially rewritten.
+
+A set of debugging macros, MU_DEBUG0 through MU_DEBUG11, is provided.
+New functions mu_debug_printf and mu_debug_vprintf allow for flexible
+formatting of debugging messages. The mu_debug_t object features
+built-in line bufferring.
+
+The new function mu_debug_check_level(d,l) returns true if the logging
+level currently set for debugging object `d' matches that given by
+`l'.
+
+New diagnostics functions are available, among them:
+
+ void mu_diag_vprintf (int level, const char *fmt, va_list ap);
+ void mu_diag_printf (int level, const char *fmt, ...);
+ void mu_diag_voutput (int level, const char *fmt, va_list ap);
+ void mu_diag_output (int level, const char *fmt, ...);
+
+A new header file, mailutils/diag.h, declarations of these and other
+related functions.
+
+See documentation (FIXME: Chapter?) for more information.
+
+The functions mu_error and mu_verror are shortcuts for
+mu_diag_output (MU_DIAG_ERROR, ...) and mu_diag_voutput (MU_DIAG_ERROR, ...),
+correspondingly.
+
+The function mu_error_set_print is deprecated as well as the
+mu_error_pfn_t type. They are, however, still supported. The following
+approach is recommended to use instead of mu_error_set_print:
+
+ mu_diag_get_debug (&debug);
+ mu_debug_set_print (debug, new_printer, NULL);
+
+* Global debugging and verbosity settings.
+
+These settings provide default values for mu_debug_t objects created
+by various library objects. The following functions are provided for
+dealing with global debugging level:
+
+ unsigned mu_global_debug_level (const char *object_name);
+ int mu_global_debug_set_level (const char *object_name, unsigned level);
+ int mu_global_debug_clear_level (const char *object_name);
+
+Each Mailutils utility understands two additional command line
+options:
+
+ --debug-level=LEVEL Set Mailutils debugging level.
+ --debug-line-info Show source info with debugging messages.
+
* New utility `maidag'
Maidag is a MAIl Delivery AGent. It is a general-purpose MDA able to
diff --git a/TODO b/TODO
index 62f6e0880..52e39cee1 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,6 @@
-GNU mailutils TODO list. 2005-03-18
-Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+GNU mailutils TODO list. 2007-11-30
+Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006,
+2007 Free Software Foundation, Inc.
* Documentation
@@ -25,10 +26,6 @@ is definitely gone.
** mailboxes don't remember whether or not they've been opened
-** mu_error() vs. debug_t: Revise both methods of reporting the
-diagnostics. Possibly they could be merged. Possibly log_t object
-is needed.
-
** does IMAP do an EXAMINE instead of a select if the mailbox is being
opened readonly? Does list return whether a mailbox is readonly?
Check against CMUs anon server, it is a read-only mailbox.
@@ -61,15 +58,6 @@ and use them in mail.remote.
** support AUTH=anonymous (imap://cyrus.andrew.cmu.edu/archive.info-cyrus)
-** support POP3S and IMAPS mailers (ports 995/993).
-Jeff Bailey says:
- I think this might be the only encryption that common versions of
- Outlook Express support. As a low priority TODO list item, (like if it
- never gets done, there's no worries) I think it can probably stay on.
-
- The advantage of having it just do this itself is that other utilities
- aren't required to get this configured up in something like Debian.
-
** filter_trans needs readline method.
* pop3
@@ -109,12 +97,8 @@ of message arrival, this is supported by imap, but we'll have to fake
for pop and local spools my polling, why can't you select() on a unix
file?)
-* mail.local: Add daemon mode with LMTP support
-
* utilities
-** forward only MTA, nullmailer like, but accepting SMTP on 25 from localhost
-
** mimeview: support nametemplate
** all
diff --git a/include/mailutils/debug.hm4 b/include/mailutils/debug.hm4
index 021cf758b..355c49f2e 100644
--- a/include/mailutils/debug.hm4
+++ b/include/mailutils/debug.hm4
@@ -57,38 +57,40 @@ struct mu_debug_locus
int mu_debug_create (mu_debug_t *, void *);
void mu_debug_destroy (mu_debug_t *, void *);
void *mu_debug_get_owner (mu_debug_t);
-int mu_debug_set_level (mu_debug_t, size_t);
-int mu_debug_get_level (mu_debug_t, size_t *);
+int mu_debug_set_level (mu_debug_t, mu_log_level_t);
+int mu_debug_get_level (mu_debug_t, mu_log_level_t *);
int mu_debug_set_locus (mu_debug_t, const char *, int);
int mu_debug_get_locus (mu_debug_t, struct mu_debug_locus *);
int mu_debug_set_function (mu_debug_t, const char *);
int mu_debug_get_function (mu_debug_t, const char **);
-int mu_debug_print (mu_debug_t, size_t, const char *, ...)
+int mu_debug_print (mu_debug_t, mu_log_level_t, const char *, ...)
MU_PRINTFLIKE(3,4);
-int mu_debug_printv (mu_debug_t, size_t, const char *, va_list);
-int mu_debug_check_level (mu_debug_t, size_t);
+int mu_debug_printv (mu_debug_t, mu_log_level_t, const char *, va_list);
+int mu_debug_check_level (mu_debug_t, mu_log_level_t);
-int mu_debug_printf (mu_debug_t, size_t, const char *, ...)
+int mu_debug_printf (mu_debug_t, mu_log_level_t, const char *, ...)
MU_PRINTFLIKE(3,4);
-int mu_debug_vprintf (mu_debug_t, size_t, const char *, va_list);
+int mu_debug_vprintf (mu_debug_t, mu_log_level_t, const char *, va_list);
extern int mu_debug_line_info;
-typedef int (*mu_debug_printer_fp) (void*, size_t, const char *);
+typedef int (*mu_debug_printer_fp) (void*, mu_log_level_t, const char *);
int mu_debug_set_print (mu_debug_t, mu_debug_printer_fp, void *);
int mu_debug_set_data (mu_debug_t, void *, void (*) (void*), void *);
extern mu_debug_printer_fp mu_debug_default_printer;
-int mu_debug_syslog_printer (void *, size_t, const char *);
-int mu_debug_stderr_printer (void *, size_t, const char *);
+int mu_debug_syslog_printer (void *, mu_log_level_t, const char *);
+int mu_debug_stderr_printer (void *, mu_log_level_t, const char *);
-unsigned mu_global_debug_level (const char *);
-int mu_global_debug_set_level (const char *, unsigned);
+mu_log_level_t mu_global_debug_level (const char *);
+int mu_global_debug_set_level (const char *, mu_log_level_t);
int mu_global_debug_clear_level (const char *);
int mu_global_debug_from_string (const char *, const char *);
+int mu_debug_level_from_string (const char *string, mu_log_level_t *plev,
+ mu_debug_t debug);
forloop(`i',1,11,`MKDEBUG(i)')
diff --git a/include/mailutils/diag.h b/include/mailutils/diag.h
index dc0efb028..d35b3daa0 100644
--- a/include/mailutils/diag.h
+++ b/include/mailutils/diag.h
@@ -44,16 +44,16 @@ void mu_set_program_name (const char *);
void mu_diag_init (void);
void mu_diag_get_debug (mu_debug_t *);
void mu_diag_set_debug (mu_debug_t);
-void mu_diag_vprintf (int, const char *, va_list);
-void mu_diag_printf (int, const char *, ...) MU_PRINTFLIKE(2,3);
-void mu_diag_voutput (int, const char *, va_list);
-void mu_diag_output (int, const char *, ...) MU_PRINTFLIKE(2,3);
+void mu_diag_vprintf (mu_log_level_t, const char *, va_list);
+void mu_diag_printf (mu_log_level_t, const char *, ...) MU_PRINTFLIKE(2,3);
+void mu_diag_voutput (mu_log_level_t, const char *, va_list);
+void mu_diag_output (mu_log_level_t, const char *, ...) MU_PRINTFLIKE(2,3);
-int mu_diag_syslog_printer (void *, size_t, const char *);
-int mu_diag_stderr_printer (void *, size_t, const char *);
+int mu_diag_syslog_printer (void *, mu_log_level_t, const char *);
+int mu_diag_stderr_printer (void *, mu_log_level_t, const char *);
-int mu_diag_level_to_syslog (int level);
-const char *mu_diag_level_to_string (int level);
+int mu_diag_level_to_syslog (mu_log_level_t level);
+const char *mu_diag_level_to_string (mu_log_level_t level);
#ifdef __cplusplus
}
diff --git a/include/mailutils/types.hin b/include/mailutils/types.hin
index e734b739d..b2a26ce7f 100644
--- a/include/mailutils/types.hin
+++ b/include/mailutils/types.hin
@@ -100,7 +100,8 @@ typedef struct _mu_wicket *mu_wicket_t;
typedef void *mu_transport_t;
typedef struct _mu_assoc *mu_assoc_t;
typedef char *mu_message_qid_t;
-
+typedef int mu_log_level_t;
+
#define MU_FOLDER_ATTRIBUTE_DIRECTORY 0x001
#define MU_FOLDER_ATTRIBUTE_FILE 0x002
#define MU_FOLDER_ATTRIBUTE_ALL \
diff --git a/mailbox/cfg_lexer.c b/mailbox/cfg_lexer.c
index 4680b1b26..d9271b892 100644
--- a/mailbox/cfg_lexer.c
+++ b/mailbox/cfg_lexer.c
@@ -229,7 +229,7 @@ again:
skipline (p);
if (strncmp (start, "debug=", 6) == 0)
{
- size_t lev;
+ mu_log_level_t lev;
if (p->curp[0] == '\n')
{
mu_cfg_locus.line++;
diff --git a/mailbox/cfg_parser.y b/mailbox/cfg_parser.y
index 04bf139c7..d6f346556 100644
--- a/mailbox/cfg_parser.y
+++ b/mailbox/cfg_parser.y
@@ -228,7 +228,7 @@ tag : MU_CFG_START_TOKEN opt_eol taglist MU_CFG_END_TOKEN MU_CFG_EOL_TOKEN
%%
static int
-_cfg_default_printer (void *unused, size_t level, const char *str)
+_cfg_default_printer (void *unused, mu_log_level_t level, const char *str)
{
fprintf (stderr, "%s", str);
return 0;
diff --git a/mailbox/dbgstderr.c b/mailbox/dbgstderr.c
index 4cc9d4b10..2e02a983d 100644
--- a/mailbox/dbgstderr.c
+++ b/mailbox/dbgstderr.c
@@ -24,7 +24,7 @@
#include <stdio.h>
int
-mu_debug_stderr_printer (void *unused, size_t level, const char *str)
+mu_debug_stderr_printer (void *unused, mu_log_level_t level, const char *str)
{
fprintf (stderr, "%s: %s",
(level == MU_DEBUG_ERROR) ? "ERROR" : "DEBUG",
diff --git a/mailbox/dbgsyslog.c b/mailbox/dbgsyslog.c
index 6964b9f71..bc0b9724b 100644
--- a/mailbox/dbgsyslog.c
+++ b/mailbox/dbgsyslog.c
@@ -24,7 +24,7 @@
#include <syslog.h>
int
-mu_debug_syslog_printer (void *unused, size_t level, const char *str)
+mu_debug_syslog_printer (void *unused, mu_log_level_t level, const char *str)
{
syslog ((level == MU_DEBUG_ERROR) ? LOG_ERR : LOG_DEBUG, "%s", str);
return 0;
diff --git a/mailbox/debug.c b/mailbox/debug.c
index b61542258..e1ac9d81d 100644
--- a/mailbox/debug.c
+++ b/mailbox/debug.c
@@ -78,7 +78,7 @@ mu_debug_get_owner (mu_debug_t debug)
}
int
-mu_debug_set_level (mu_debug_t debug, size_t level)
+mu_debug_set_level (mu_debug_t debug, mu_log_level_t level)
{
if (debug == NULL)
return EINVAL;
@@ -87,7 +87,7 @@ mu_debug_set_level (mu_debug_t debug, size_t level)
}
int
-mu_debug_get_level (mu_debug_t debug, size_t *plevel)
+mu_debug_get_level (mu_debug_t debug, mu_log_level_t *plevel)
{
if (debug == NULL)
return EINVAL;
@@ -143,7 +143,7 @@ debug_format_prefix (mu_debug_t debug)
}
int
-mu_debug_vprintf (mu_debug_t debug, size_t level,
+mu_debug_vprintf (mu_debug_t debug, mu_log_level_t level,
const char *format, va_list ap)
{
if (debug == NULL || format == NULL)
@@ -214,7 +214,8 @@ mu_debug_vprintf (mu_debug_t debug, size_t level,
}
int
-mu_debug_printf (mu_debug_t debug, size_t level, const char *format, ...)
+mu_debug_printf (mu_debug_t debug, mu_log_level_t level,
+ const char *format, ...)
{
va_list ap;
@@ -226,7 +227,8 @@ mu_debug_printf (mu_debug_t debug, size_t level, const char *format, ...)
int
-mu_debug_print (mu_debug_t debug, size_t level, const char *format, ...)
+mu_debug_print (mu_debug_t debug, mu_log_level_t level,
+ const char *format, ...)
{
va_list ap;
mu_debug_printv (debug, level, format, ap);
@@ -235,7 +237,7 @@ mu_debug_print (mu_debug_t debug, size_t level, const char *format, ...)
}
int
-mu_debug_printv (mu_debug_t debug, size_t level, const char *format,
+mu_debug_printv (mu_debug_t debug, mu_log_level_t level, const char *format,
va_list ap)
{
if (debug == NULL || format == NULL)
@@ -246,7 +248,7 @@ mu_debug_printv (mu_debug_t debug, size_t level, const char *format,
}
int
-mu_debug_check_level (mu_debug_t debug, size_t level)
+mu_debug_check_level (mu_debug_t debug, mu_log_level_t level)
{
if (!debug)
return 0;
diff --git a/mailbox/diag.c b/mailbox/diag.c
index bab5f9fb5..1af7a7162 100644
--- a/mailbox/diag.c
+++ b/mailbox/diag.c
@@ -87,14 +87,14 @@ mu_diag_set_debug (mu_debug_t debug)
}
void
-mu_diag_vprintf (int level, const char *fmt, va_list ap)
+mu_diag_vprintf (mu_log_level_t level, const char *fmt, va_list ap)
{
mu_diag_init ();
mu_debug_vprintf (mu_diag_debug, level, fmt, ap);
}
void
-mu_diag_printf (int level, const char *fmt, ...)
+mu_diag_printf (mu_log_level_t level, const char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
@@ -103,7 +103,7 @@ mu_diag_printf (int level, const char *fmt, ...)
}
void
-mu_diag_voutput (int level, const char *fmt, va_list ap)
+mu_diag_voutput (mu_log_level_t level, const char *fmt, va_list ap)
{
mu_diag_init ();
mu_debug_vprintf (mu_diag_debug, level, fmt, ap);
@@ -111,7 +111,7 @@ mu_diag_voutput (int level, const char *fmt, va_list ap)
}
void
-mu_diag_output (int level, const char *fmt, ...)
+mu_diag_output (mu_log_level_t level, const char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
@@ -120,7 +120,7 @@ mu_diag_output (int level, const char *fmt, ...)
}
const char *
-mu_diag_level_to_string (int level)
+mu_diag_level_to_string (mu_log_level_t level)
{
switch (level)
{
@@ -152,7 +152,7 @@ mu_diag_level_to_string (int level)
}
int
-mu_diag_stderr_printer (void *data, size_t level, const char *buf)
+mu_diag_stderr_printer (void *data, mu_log_level_t level, const char *buf)
{
if (mu_program_name)
fprintf (stderr, "%s: ", mu_program_name);
diff --git a/mailbox/gdebug.c b/mailbox/gdebug.c
index 911e38165..af60fc2e1 100644
--- a/mailbox/gdebug.c
+++ b/mailbox/gdebug.c
@@ -44,7 +44,7 @@ struct debug_level
static mu_assoc_t debug_table;
-unsigned
+mu_log_level_t
mu_global_debug_level (const char *object_name)
{
struct debug_level *p = mu_assoc_ref (debug_table, object_name);
@@ -54,7 +54,7 @@ mu_global_debug_level (const char *object_name)
}
int
-mu_global_debug_set_level (const char *object_name, unsigned level)
+mu_global_debug_set_level (const char *object_name, mu_log_level_t level)
{
int rc;
struct debug_level *dbg;
@@ -99,7 +99,8 @@ decode_debug_level (const char *p, int *lev)
}
int
-mu_debug_level_from_string (const char *string, size_t *plev, mu_debug_t debug)
+mu_debug_level_from_string (const char *string, mu_log_level_t *plev,
+ mu_debug_t debug)
{
char *p, *q;
unsigned level = MU_DEBUG_INHERIT;
@@ -175,7 +176,7 @@ mu_global_debug_from_string (const char *string, const char *errpfx)
for (i = 0; i < argc; i++)
{
char *p;
- unsigned level = MU_DEBUG_INHERIT;
+ mu_log_level_t level = MU_DEBUG_INHERIT;
char *object_name = argv[i];
for (p = object_name; *p && *p != '='; p++)
diff --git a/mailbox/muerror.c b/mailbox/muerror.c
index dabd68c61..fd0d7f1fa 100644
--- a/mailbox/muerror.c
+++ b/mailbox/muerror.c
@@ -81,7 +81,7 @@ compat_error_printer0 (mu_error_pfn_t pfn, const char *fmt, ...)
}
static int
-compat_error_printer (void *data, size_t level, const char *buf)
+compat_error_printer (void *data, mu_log_level_t level, const char *buf)
{
if (!data)
mu_diag_stderr_printer (NULL, level, buf);
diff --git a/mailbox/syslog.c b/mailbox/syslog.c
index 43c4ec9f3..7df35ce15 100644
--- a/mailbox/syslog.c
+++ b/mailbox/syslog.c
@@ -106,7 +106,7 @@ mu_syslog_priority_to_string (int n)
}
int
-mu_diag_level_to_syslog (int level)
+mu_diag_level_to_syslog (mu_log_level_t level)
{
switch (level)
{
@@ -138,7 +138,7 @@ mu_diag_level_to_syslog (int level)
}
int
-mu_diag_syslog_printer (void *data, size_t level, const char *buf)
+mu_diag_syslog_printer (void *data, mu_log_level_t level, const char *buf)
{
int len = strlen (buf);
if (len > 0 && buf[len-1] == '\n')
diff --git a/sieve/sieve.c b/sieve/sieve.c
index 4f0f1a01b..72fd83c7a 100644
--- a/sieve/sieve.c
+++ b/sieve/sieve.c
@@ -164,7 +164,7 @@ set_debug_level (mu_debug_t debug, const char *arg)
}
int
-mu_compat_printer (void *data, size_t level, const char *buf)
+mu_compat_printer (void *data, mu_log_level_t level, const char *buf)
{
fputs (buf, stderr);
return 0;

Return to:

Send suggestions and report system problems to the System administrator.