* 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.
Showing
14 changed files
with
39 additions
and
20 deletions
1 | 2008-01-14 Sergey Poznyakoff <gray@gnu.org.ua> | 1 | 2008-01-14 Sergey Poznyakoff <gray@gnu.org.ua> |
2 | 2 | ||
3 | * include/mailutils/gocs.h (log_facility): Remove. | ||
4 | * include/mailutils/syslog.h (mu_log_facility, mu_log_tag): New | ||
5 | declarations. | ||
6 | (MU_LOG_TAG): New define. | ||
7 | * mailbox/gocs.c (mu_gocs_logging_init): Set mu_log_tag. | ||
8 | * mailbox/syslog.c (mu_log_facility, mu_log_tag): New variables. | ||
9 | * libcfg/common.c (mu_logging_param): New statement `tag'. | ||
10 | * comsat/comsat.c, imap4d/imap4d.c, imap4d/login.c, | ||
11 | maidag/maidag.c, mail.local/main.c, pop3d/pop3d.c, pop3d/user.c, | ||
12 | sieve/sieve.c: Use MU_LOG_TAG in openlog, and | ||
13 | program_version in mu_m_server_create calls. | ||
14 | |||
3 | * libsieve/conf.c (mu_sieve_module_init): Remove initial call to | 15 | * libsieve/conf.c (mu_sieve_module_init): Remove initial call to |
4 | _path_append. | 16 | _path_append. |
5 | * libsieve/load.c (sieve_init_load_path): New function. | 17 | * libsieve/load.c (sieve_init_load_path): New function. | ... | ... |
... | @@ -570,7 +570,7 @@ main (int argc, char **argv) | ... | @@ -570,7 +570,7 @@ main (int argc, char **argv) |
570 | comsat_init (); | 570 | comsat_init (); |
571 | mu_acl_cfg_init (); | 571 | mu_acl_cfg_init (); |
572 | mu_m_server_cfg_init (); | 572 | mu_m_server_cfg_init (); |
573 | mu_m_server_create (&server, "GNU comsat"); | 573 | mu_m_server_create (&server, program_version); |
574 | mu_m_server_set_type (server, MU_IP_UDP); | 574 | mu_m_server_set_type (server, MU_IP_UDP); |
575 | mu_m_server_set_conn (server, comsat_connection); | 575 | mu_m_server_set_conn (server, comsat_connection); |
576 | mu_m_server_set_prefork (server, comsat_prefork); | 576 | mu_m_server_set_prefork (server, comsat_prefork); |
... | @@ -618,7 +618,7 @@ main (int argc, char **argv) | ... | @@ -618,7 +618,7 @@ main (int argc, char **argv) |
618 | } | 618 | } |
619 | 619 | ||
620 | /* Set up error messaging */ | 620 | /* Set up error messaging */ |
621 | openlog ("gnu-comsat", LOG_PID, log_facility); | 621 | openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); |
622 | 622 | ||
623 | { | 623 | { |
624 | mu_debug_t debug; | 624 | mu_debug_t debug; | ... | ... |
... | @@ -482,7 +482,7 @@ main (int argc, char **argv) | ... | @@ -482,7 +482,7 @@ main (int argc, char **argv) |
482 | 482 | ||
483 | mu_argp_init (program_version, NULL); | 483 | mu_argp_init (program_version, NULL); |
484 | 484 | ||
485 | mu_m_server_create (&server, "GNU imap4d"); | 485 | mu_m_server_create (&server, program_version); |
486 | mu_m_server_set_conn (server, imap4d_connection); | 486 | mu_m_server_set_conn (server, imap4d_connection); |
487 | mu_m_server_set_prefork (server, mu_tcp_wrapper_prefork); | 487 | mu_m_server_set_prefork (server, mu_tcp_wrapper_prefork); |
488 | mu_m_server_set_mode (server, MODE_INTERACTIVE); | 488 | mu_m_server_set_mode (server, MODE_INTERACTIVE); |
... | @@ -542,7 +542,7 @@ main (int argc, char **argv) | ... | @@ -542,7 +542,7 @@ main (int argc, char **argv) |
542 | signal (SIGABRT, imap4d_signal); | 542 | signal (SIGABRT, imap4d_signal); |
543 | 543 | ||
544 | /* Set up for syslog. */ | 544 | /* Set up for syslog. */ |
545 | openlog ("gnu-imap4d", LOG_PID, log_facility); | 545 | openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); |
546 | 546 | ||
547 | /* Redirect any stdout error from the library to syslog, they | 547 | /* Redirect any stdout error from the library to syslog, they |
548 | should not go to the client. */ | 548 | should not go to the client. */ | ... | ... |
... | @@ -49,7 +49,7 @@ imap4d_login (struct imap4d_command *command, char *arg) | ... | @@ -49,7 +49,7 @@ imap4d_login (struct imap4d_command *command, char *arg) |
49 | } | 49 | } |
50 | 50 | ||
51 | rc = mu_authenticate (auth_data, pass); | 51 | rc = mu_authenticate (auth_data, pass); |
52 | openlog ("gnu-imap4d", LOG_PID, log_facility); | 52 | openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); |
53 | if (rc) | 53 | if (rc) |
54 | { | 54 | { |
55 | mu_diag_output (MU_DIAG_INFO, _("Login failed: %s"), username); | 55 | mu_diag_output (MU_DIAG_INFO, _("Login failed: %s"), username); | ... | ... |
... | @@ -21,6 +21,7 @@ | ... | @@ -21,6 +21,7 @@ |
21 | 21 | ||
22 | #include <mailutils/types.h> | 22 | #include <mailutils/types.h> |
23 | #include <mailutils/list.h> | 23 | #include <mailutils/list.h> |
24 | #include <mailutils/syslog.h> | ||
24 | 25 | ||
25 | #ifdef __cplusplus | 26 | #ifdef __cplusplus |
26 | extern "C" { | 27 | extern "C" { |
... | @@ -81,9 +82,6 @@ extern int mu_load_user_rcfile; | ... | @@ -81,9 +82,6 @@ extern int mu_load_user_rcfile; |
81 | extern int mu_load_site_rcfile; | 82 | extern int mu_load_site_rcfile; |
82 | extern char *mu_load_rcfile; | 83 | extern char *mu_load_rcfile; |
83 | 84 | ||
84 | extern int log_facility; /* FIXME: 1. Belongs elsewhere; | ||
85 | 2. Does not begin with `mu_' */ | ||
86 | |||
87 | typedef int (*gocs_init_fp) (void *data); | 85 | typedef int (*gocs_init_fp) (void *data); |
88 | 86 | ||
89 | void mu_gocs_register (const char *capa, gocs_init_fp init); | 87 | void mu_gocs_register (const char *capa, gocs_init_fp init); | ... | ... |
... | @@ -25,6 +25,10 @@ | ... | @@ -25,6 +25,10 @@ |
25 | extern "C" { | 25 | extern "C" { |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | extern int mu_log_facility; | ||
29 | extern char *mu_log_tag; | ||
30 | #define MU_LOG_TAG() (mu_log_tag ? mu_log_tag : mu_program_name) | ||
31 | |||
28 | int mu_string_to_syslog_facility (char *str, int *pfacility); | 32 | int mu_string_to_syslog_facility (char *str, int *pfacility); |
29 | const char *mu_syslog_facility_to_string (int n); | 33 | const char *mu_syslog_facility_to_string (int n); |
30 | int mu_string_to_syslog_priority (char *str, int *pprio); | 34 | int mu_string_to_syslog_priority (char *str, int *pprio); | ... | ... |
... | @@ -144,6 +144,8 @@ static struct mu_cfg_param mu_logging_param[] = { | ... | @@ -144,6 +144,8 @@ static struct mu_cfg_param mu_logging_param[] = { |
144 | N_("Set syslog facility. Arg is one of the following: user, daemon, " | 144 | N_("Set syslog facility. Arg is one of the following: user, daemon, " |
145 | "auth, authpriv, mail, cron, local0 through local7 (case-insensitive), " | 145 | "auth, authpriv, mail, cron, local0 through local7 (case-insensitive), " |
146 | "or a facility number.") }, | 146 | "or a facility number.") }, |
147 | { "tag", mu_cfg_string, &mu_log_tag, 0, NULL, | ||
148 | N_("Tag syslog messages with this string.") }, | ||
147 | { NULL } | 149 | { NULL } |
148 | }; | 150 | }; |
149 | 151 | ... | ... |
... | @@ -476,7 +476,7 @@ main (int argc, char *argv[]) | ... | @@ -476,7 +476,7 @@ main (int argc, char *argv[]) |
476 | /* Parse command line */ | 476 | /* Parse command line */ |
477 | mu_argp_init (program_version, NULL); | 477 | mu_argp_init (program_version, NULL); |
478 | 478 | ||
479 | mu_m_server_create (&server, "GNU maidag"); | 479 | mu_m_server_create (&server, program_version); |
480 | mu_m_server_set_conn (server, lmtp_connection); | 480 | mu_m_server_set_conn (server, lmtp_connection); |
481 | mu_m_server_set_prefork (server, mu_tcp_wrapper_prefork); | 481 | mu_m_server_set_prefork (server, mu_tcp_wrapper_prefork); |
482 | mu_m_server_set_mode (server, MODE_INTERACTIVE); | 482 | mu_m_server_set_mode (server, MODE_INTERACTIVE); |
... | @@ -496,7 +496,7 @@ main (int argc, char *argv[]) | ... | @@ -496,7 +496,7 @@ main (int argc, char *argv[]) |
496 | { | 496 | { |
497 | mu_debug_t debug; | 497 | mu_debug_t debug; |
498 | 498 | ||
499 | openlog ("maidag", LOG_PID, log_facility); | 499 | openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); |
500 | mu_diag_get_debug (&debug); | 500 | mu_diag_get_debug (&debug); |
501 | mu_debug_set_print (debug, mu_diag_syslog_printer, NULL); | 501 | mu_debug_set_print (debug, mu_diag_syslog_printer, NULL); |
502 | 502 | ... | ... |
... | @@ -398,8 +398,7 @@ main (int argc, char *argv[]) | ... | @@ -398,8 +398,7 @@ main (int argc, char *argv[]) |
398 | if (uid == 0) | 398 | if (uid == 0) |
399 | { | 399 | { |
400 | mu_debug_t debug; | 400 | mu_debug_t debug; |
401 | 401 | openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); | |
402 | openlog ("mail.local", LOG_PID, log_facility); | ||
403 | mu_diag_get_debug (&debug); | 402 | mu_diag_get_debug (&debug); |
404 | mu_debug_set_print (debug, mu_diag_syslog_printer, NULL); | 403 | mu_debug_set_print (debug, mu_diag_syslog_printer, NULL); |
405 | } | 404 | } | ... | ... |
... | @@ -31,6 +31,7 @@ | ... | @@ -31,6 +31,7 @@ |
31 | #include <mailutils/errno.h> | 31 | #include <mailutils/errno.h> |
32 | #include <mailutils/nls.h> | 32 | #include <mailutils/nls.h> |
33 | #include <mailutils/debug.h> | 33 | #include <mailutils/debug.h> |
34 | #include <mailutils/syslog.h> | ||
34 | #include <syslog.h> | 35 | #include <syslog.h> |
35 | 36 | ||
36 | int mu_load_user_rcfile = 1; | 37 | int mu_load_user_rcfile = 1; |
... | @@ -216,12 +217,14 @@ mu_gocs_logging_init (void *data) | ... | @@ -216,12 +217,14 @@ mu_gocs_logging_init (void *data) |
216 | 217 | ||
217 | if (p->facility) | 218 | if (p->facility) |
218 | { | 219 | { |
219 | log_facility = p->facility; | 220 | mu_log_facility = p->facility; |
220 | mu_debug_default_printer = mu_debug_syslog_printer; | 221 | mu_debug_default_printer = mu_debug_syslog_printer; |
221 | } | 222 | } |
222 | else | 223 | else |
223 | mu_debug_default_printer = mu_debug_stderr_printer; | 224 | mu_debug_default_printer = mu_debug_stderr_printer; |
224 | 225 | ||
226 | if (p->tag) | ||
227 | mu_log_tag = strdup (p->tag); | ||
225 | /* FIXME: Tag */ | 228 | /* FIXME: Tag */ |
226 | return 0; | 229 | return 0; |
227 | } | 230 | } | ... | ... |
... | @@ -135,4 +135,5 @@ mu_diag_syslog_printer (void *data, mu_log_level_t level, const char *buf) | ... | @@ -135,4 +135,5 @@ mu_diag_syslog_printer (void *data, mu_log_level_t level, const char *buf) |
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
138 | int log_facility = LOG_FACILITY; | 138 | int mu_log_facility = LOG_FACILITY; |
139 | char *mu_log_tag = NULL; | ... | ... |
... | @@ -478,7 +478,7 @@ main (int argc, char **argv) | ... | @@ -478,7 +478,7 @@ main (int argc, char **argv) |
478 | 478 | ||
479 | mu_argp_init (program_version, NULL); | 479 | mu_argp_init (program_version, NULL); |
480 | 480 | ||
481 | mu_m_server_create (&server, "GNU pop3d"); | 481 | mu_m_server_create (&server, program_version); |
482 | mu_m_server_set_conn (server, pop3d_connection); | 482 | mu_m_server_set_conn (server, pop3d_connection); |
483 | mu_m_server_set_prefork (server, mu_tcp_wrapper_prefork); | 483 | mu_m_server_set_prefork (server, mu_tcp_wrapper_prefork); |
484 | mu_m_server_set_mode (server, MODE_INTERACTIVE); | 484 | mu_m_server_set_mode (server, MODE_INTERACTIVE); |
... | @@ -533,7 +533,7 @@ main (int argc, char **argv) | ... | @@ -533,7 +533,7 @@ main (int argc, char **argv) |
533 | signal (SIGABRT, pop3d_signal); | 533 | signal (SIGABRT, pop3d_signal); |
534 | 534 | ||
535 | /* Set up for syslog. */ | 535 | /* Set up for syslog. */ |
536 | openlog ("gnu-pop3d", LOG_PID, log_facility); | 536 | openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); |
537 | /* Redirect any stdout error from the library to syslog, they | 537 | /* Redirect any stdout error from the library to syslog, they |
538 | should not go to the client. */ | 538 | should not go to the client. */ |
539 | { | 539 | { | ... | ... |
... | @@ -146,7 +146,7 @@ pop3d_user (const char *arg) | ... | @@ -146,7 +146,7 @@ pop3d_user (const char *arg) |
146 | } | 146 | } |
147 | 147 | ||
148 | rc = mu_authenticate (auth_data, pass); | 148 | rc = mu_authenticate (auth_data, pass); |
149 | openlog ("gnu-pop3d", LOG_PID, log_facility); | 149 | openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); |
150 | 150 | ||
151 | if (rc) | 151 | if (rc) |
152 | { | 152 | { | ... | ... |
... | @@ -384,7 +384,7 @@ main (int argc, char *argv[]) | ... | @@ -384,7 +384,7 @@ main (int argc, char *argv[]) |
384 | tickets = mu_tilde_expansion ("~/.tickets", "/", NULL); | 384 | tickets = mu_tilde_expansion ("~/.tickets", "/", NULL); |
385 | tickets_default = 1; | 385 | tickets_default = 1; |
386 | debug_level = MU_DEBUG_LEVEL_MASK (MU_DEBUG_ERROR); | 386 | debug_level = MU_DEBUG_LEVEL_MASK (MU_DEBUG_ERROR); |
387 | log_facility = 0; | 387 | mu_log_facility = 0; |
388 | 388 | ||
389 | if (mu_app_init (&argp, sieve_argp_capa, sieve_cfg_param, | 389 | if (mu_app_init (&argp, sieve_argp_capa, sieve_cfg_param, |
390 | argc, argv, ARGP_IN_ORDER, NULL, NULL)) | 390 | argc, argv, ARGP_IN_ORDER, NULL, NULL)) |
... | @@ -398,12 +398,12 @@ main (int argc, char *argv[]) | ... | @@ -398,12 +398,12 @@ main (int argc, char *argv[]) |
398 | return 1; | 398 | return 1; |
399 | } | 399 | } |
400 | 400 | ||
401 | if (log_facility) | 401 | if (mu_log_facility) |
402 | { | 402 | { |
403 | mu_debug_t debug; | 403 | mu_debug_t debug; |
404 | 404 | ||
405 | mu_diag_get_debug (&debug); | 405 | mu_diag_get_debug (&debug); |
406 | openlog ("sieve", LOG_PID, log_facility); | 406 | openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); |
407 | mu_debug_set_print (debug, mu_diag_syslog_printer, NULL); | 407 | mu_debug_set_print (debug, mu_diag_syslog_printer, NULL); |
408 | } | 408 | } |
409 | 409 | ... | ... |
-
Please register or sign in to post a comment