diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-01-14 16:53:36 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-01-14 16:53:36 +0000 |
commit | a227b3f8a8704188ea460f7550e50fbfab3d5221 (patch) | |
tree | 654b1c01b6fd2d1c171c5c235438fdbf033e53ef | |
parent | 1413c3ce86580156df4b68941eb2a1f77eeab7be (diff) | |
download | mailutils-a227b3f8a8704188ea460f7550e50fbfab3d5221.tar.gz mailutils-a227b3f8a8704188ea460f7550e50fbfab3d5221.tar.bz2 |
* include/mailutils/gocs.h (log_facility): Remove.
* include/mailutils/syslog.h (mu_log_facility, mu_log_tag): New
declarations.
(MU_LOG_TAG): New define.
* mailbox/gocs.c (mu_gocs_logging_init): Set mu_log_tag.
* mailbox/syslog.c (mu_log_facility, mu_log_tag): New variables.
* libcfg/common.c (mu_logging_param): New statement `tag'.
* comsat/comsat.c, imap4d/imap4d.c, imap4d/login.c,
maidag/maidag.c, mail.local/main.c, pop3d/pop3d.c, pop3d/user.c,
sieve/sieve.c: Use MU_LOG_TAG in openlog, and
program_version in mu_m_server_create calls.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | comsat/comsat.c | 4 | ||||
-rw-r--r-- | imap4d/imap4d.c | 4 | ||||
-rw-r--r-- | imap4d/login.c | 2 | ||||
-rw-r--r-- | include/mailutils/gocs.h | 4 | ||||
-rw-r--r-- | include/mailutils/syslog.h | 4 | ||||
-rw-r--r-- | libcfg/common.c | 2 | ||||
-rw-r--r-- | maidag/maidag.c | 4 | ||||
-rw-r--r-- | mail.local/main.c | 3 | ||||
-rw-r--r-- | mailbox/gocs.c | 7 | ||||
-rw-r--r-- | mailbox/syslog.c | 3 | ||||
-rw-r--r-- | pop3d/pop3d.c | 4 | ||||
-rw-r--r-- | pop3d/user.c | 2 | ||||
-rw-r--r-- | sieve/sieve.c | 6 |
14 files changed, 40 insertions, 21 deletions
@@ -1,5 +1,17 @@ 2008-01-14 Sergey Poznyakoff <gray@gnu.org.ua> + * include/mailutils/gocs.h (log_facility): Remove. + * include/mailutils/syslog.h (mu_log_facility, mu_log_tag): New + declarations. + (MU_LOG_TAG): New define. + * mailbox/gocs.c (mu_gocs_logging_init): Set mu_log_tag. + * mailbox/syslog.c (mu_log_facility, mu_log_tag): New variables. + * libcfg/common.c (mu_logging_param): New statement `tag'. + * comsat/comsat.c, imap4d/imap4d.c, imap4d/login.c, + maidag/maidag.c, mail.local/main.c, pop3d/pop3d.c, pop3d/user.c, + sieve/sieve.c: Use MU_LOG_TAG in openlog, and + program_version in mu_m_server_create calls. + * libsieve/conf.c (mu_sieve_module_init): Remove initial call to _path_append. * libsieve/load.c (sieve_init_load_path): New function. diff --git a/comsat/comsat.c b/comsat/comsat.c index 51725d773..7f09f8ce4 100644 --- a/comsat/comsat.c +++ b/comsat/comsat.c @@ -570,7 +570,7 @@ main (int argc, char **argv) comsat_init (); mu_acl_cfg_init (); mu_m_server_cfg_init (); - mu_m_server_create (&server, "GNU comsat"); + mu_m_server_create (&server, program_version); mu_m_server_set_type (server, MU_IP_UDP); mu_m_server_set_conn (server, comsat_connection); mu_m_server_set_prefork (server, comsat_prefork); @@ -618,7 +618,7 @@ main (int argc, char **argv) } /* Set up error messaging */ - openlog ("gnu-comsat", LOG_PID, log_facility); + openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); { mu_debug_t debug; diff --git a/imap4d/imap4d.c b/imap4d/imap4d.c index 4dd6bbd14..62c19b3a2 100644 --- a/imap4d/imap4d.c +++ b/imap4d/imap4d.c @@ -482,7 +482,7 @@ main (int argc, char **argv) mu_argp_init (program_version, NULL); - mu_m_server_create (&server, "GNU imap4d"); + mu_m_server_create (&server, program_version); mu_m_server_set_conn (server, imap4d_connection); mu_m_server_set_prefork (server, mu_tcp_wrapper_prefork); mu_m_server_set_mode (server, MODE_INTERACTIVE); @@ -542,7 +542,7 @@ main (int argc, char **argv) signal (SIGABRT, imap4d_signal); /* Set up for syslog. */ - openlog ("gnu-imap4d", LOG_PID, log_facility); + openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); /* Redirect any stdout error from the library to syslog, they should not go to the client. */ diff --git a/imap4d/login.c b/imap4d/login.c index bdf385fd3..1f16f64a4 100644 --- a/imap4d/login.c +++ b/imap4d/login.c @@ -49,7 +49,7 @@ imap4d_login (struct imap4d_command *command, char *arg) } rc = mu_authenticate (auth_data, pass); - openlog ("gnu-imap4d", LOG_PID, log_facility); + openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); if (rc) { mu_diag_output (MU_DIAG_INFO, _("Login failed: %s"), username); diff --git a/include/mailutils/gocs.h b/include/mailutils/gocs.h index 03a491374..fe0da0fa0 100644 --- a/include/mailutils/gocs.h +++ b/include/mailutils/gocs.h @@ -21,6 +21,7 @@ #include <mailutils/types.h> #include <mailutils/list.h> +#include <mailutils/syslog.h> #ifdef __cplusplus extern "C" { @@ -81,9 +82,6 @@ extern int mu_load_user_rcfile; extern int mu_load_site_rcfile; extern char *mu_load_rcfile; -extern int log_facility; /* FIXME: 1. Belongs elsewhere; - 2. Does not begin with `mu_' */ - typedef int (*gocs_init_fp) (void *data); void mu_gocs_register (const char *capa, gocs_init_fp init); diff --git a/include/mailutils/syslog.h b/include/mailutils/syslog.h index e19e21883..b32b45c65 100644 --- a/include/mailutils/syslog.h +++ b/include/mailutils/syslog.h @@ -25,6 +25,10 @@ extern "C" { #endif +extern int mu_log_facility; +extern char *mu_log_tag; +#define MU_LOG_TAG() (mu_log_tag ? mu_log_tag : mu_program_name) + int mu_string_to_syslog_facility (char *str, int *pfacility); const char *mu_syslog_facility_to_string (int n); int mu_string_to_syslog_priority (char *str, int *pprio); diff --git a/libcfg/common.c b/libcfg/common.c index 10af448a2..28e37375b 100644 --- a/libcfg/common.c +++ b/libcfg/common.c @@ -144,6 +144,8 @@ static struct mu_cfg_param mu_logging_param[] = { N_("Set syslog facility. Arg is one of the following: user, daemon, " "auth, authpriv, mail, cron, local0 through local7 (case-insensitive), " "or a facility number.") }, + { "tag", mu_cfg_string, &mu_log_tag, 0, NULL, + N_("Tag syslog messages with this string.") }, { NULL } }; diff --git a/maidag/maidag.c b/maidag/maidag.c index 7b20267c9..91d601750 100644 --- a/maidag/maidag.c +++ b/maidag/maidag.c @@ -476,7 +476,7 @@ main (int argc, char *argv[]) /* Parse command line */ mu_argp_init (program_version, NULL); - mu_m_server_create (&server, "GNU maidag"); + mu_m_server_create (&server, program_version); mu_m_server_set_conn (server, lmtp_connection); mu_m_server_set_prefork (server, mu_tcp_wrapper_prefork); mu_m_server_set_mode (server, MODE_INTERACTIVE); @@ -496,7 +496,7 @@ main (int argc, char *argv[]) { mu_debug_t debug; - openlog ("maidag", LOG_PID, log_facility); + openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); mu_diag_get_debug (&debug); mu_debug_set_print (debug, mu_diag_syslog_printer, NULL); diff --git a/mail.local/main.c b/mail.local/main.c index 72dfb924e..556f834bf 100644 --- a/mail.local/main.c +++ b/mail.local/main.c @@ -398,8 +398,7 @@ main (int argc, char *argv[]) if (uid == 0) { mu_debug_t debug; - - openlog ("mail.local", LOG_PID, log_facility); + openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); mu_diag_get_debug (&debug); mu_debug_set_print (debug, mu_diag_syslog_printer, NULL); } diff --git a/mailbox/gocs.c b/mailbox/gocs.c index d64ff5eff..27743b2ea 100644 --- a/mailbox/gocs.c +++ b/mailbox/gocs.c @@ -31,6 +31,7 @@ #include <mailutils/errno.h> #include <mailutils/nls.h> #include <mailutils/debug.h> +#include <mailutils/syslog.h> #include <syslog.h> int mu_load_user_rcfile = 1; @@ -216,12 +217,14 @@ mu_gocs_logging_init (void *data) if (p->facility) { - log_facility = p->facility; + mu_log_facility = p->facility; mu_debug_default_printer = mu_debug_syslog_printer; } else mu_debug_default_printer = mu_debug_stderr_printer; - + + if (p->tag) + mu_log_tag = strdup (p->tag); /* FIXME: Tag */ return 0; } diff --git a/mailbox/syslog.c b/mailbox/syslog.c index 86f4c443e..5ab89eb7b 100644 --- a/mailbox/syslog.c +++ b/mailbox/syslog.c @@ -135,4 +135,5 @@ mu_diag_syslog_printer (void *data, mu_log_level_t level, const char *buf) } -int log_facility = LOG_FACILITY; +int mu_log_facility = LOG_FACILITY; +char *mu_log_tag = NULL; diff --git a/pop3d/pop3d.c b/pop3d/pop3d.c index a9928a836..5819b2c6e 100644 --- a/pop3d/pop3d.c +++ b/pop3d/pop3d.c @@ -478,7 +478,7 @@ main (int argc, char **argv) mu_argp_init (program_version, NULL); - mu_m_server_create (&server, "GNU pop3d"); + mu_m_server_create (&server, program_version); mu_m_server_set_conn (server, pop3d_connection); mu_m_server_set_prefork (server, mu_tcp_wrapper_prefork); mu_m_server_set_mode (server, MODE_INTERACTIVE); @@ -533,7 +533,7 @@ main (int argc, char **argv) signal (SIGABRT, pop3d_signal); /* Set up for syslog. */ - openlog ("gnu-pop3d", LOG_PID, log_facility); + openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); /* Redirect any stdout error from the library to syslog, they should not go to the client. */ { diff --git a/pop3d/user.c b/pop3d/user.c index 36dac0a32..91a4f4412 100644 --- a/pop3d/user.c +++ b/pop3d/user.c @@ -146,7 +146,7 @@ pop3d_user (const char *arg) } rc = mu_authenticate (auth_data, pass); - openlog ("gnu-pop3d", LOG_PID, log_facility); + openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); if (rc) { diff --git a/sieve/sieve.c b/sieve/sieve.c index 50f61fab0..07feda6fc 100644 --- a/sieve/sieve.c +++ b/sieve/sieve.c @@ -384,7 +384,7 @@ main (int argc, char *argv[]) tickets = mu_tilde_expansion ("~/.tickets", "/", NULL); tickets_default = 1; debug_level = MU_DEBUG_LEVEL_MASK (MU_DEBUG_ERROR); - log_facility = 0; + mu_log_facility = 0; if (mu_app_init (&argp, sieve_argp_capa, sieve_cfg_param, argc, argv, ARGP_IN_ORDER, NULL, NULL)) @@ -398,12 +398,12 @@ main (int argc, char *argv[]) return 1; } - if (log_facility) + if (mu_log_facility) { mu_debug_t debug; mu_diag_get_debug (&debug); - openlog ("sieve", LOG_PID, log_facility); + openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); mu_debug_set_print (debug, mu_diag_syslog_printer, NULL); } |