aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2013-03-10 23:25:11 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2013-03-10 23:26:52 +0200
commit39a97e438dde837ada9a99cceea93a1cf97db19e (patch)
treeefc492dcfcdc2c21bfdec5c31692b348601cd94a /modules
parent87602f5492b842f734dffe22f4e2f85dbc6ce713 (diff)
downloadwydawca-39a97e438dde837ada9a99cceea93a1cf97db19e.tar.gz
wydawca-39a97e438dde837ada9a99cceea93a1cf97db19e.tar.bz2
Provide a convenient debugging macro.
Rename logmsg to wy_log.
Diffstat (limited to 'modules')
-rw-r--r--modules/mailutils/mod_mailutils.c59
1 files changed, 28 insertions, 31 deletions
diff --git a/modules/mailutils/mod_mailutils.c b/modules/mailutils/mod_mailutils.c
index 96accc7..a466f80 100644
--- a/modules/mailutils/mod_mailutils.c
+++ b/modules/mailutils/mod_mailutils.c
@@ -131,7 +131,7 @@ mu_stream_data_read_cb(void *handle, void *buffer, size_t size)
rc = mu_stream_read(str, buffer, size, &nread);
if (rc) {
- logmsg(LOG_ERR, "mu_stream_read: %s", mu_strerror(rc));
+ wy_log(LOG_ERR, "mu_stream_read: %s", mu_strerror(rc));
errno = EIO;
return -1;
}
@@ -144,19 +144,19 @@ check_sign_result(gpgme_sign_result_t result, gpgme_sig_mode_t type)
gpgme_new_signature_t sign;
if (result->invalid_signers) {
- logmsg(LOG_ERR, _("GPGME: invalid signer found: %s"),
+ wy_log(LOG_ERR, _("GPGME: invalid signer found: %s"),
result->invalid_signers->fpr);
return 1;
}
if (!result->signatures) {
- logmsg(LOG_ERR, _("GPGME: no signatures created"));
+ wy_log(LOG_ERR, _("GPGME: no signatures created"));
return 1;
}
for (sign = result->signatures; sign; sign = sign->next) {
if (sign->type != type) {
- logmsg(LOG_ERR,
+ wy_log(LOG_ERR,
_("GPGME: wrong type of signature created"));
return 1;
}
@@ -175,7 +175,7 @@ gpg_sign(gpgme_data_t * output, gpgme_data_t input, const char *sign_keys)
err = gpgme_new(&ctx);
if (err) {
- logmsg(LOG_ERR, _("GPGME: cannot create context: %s"),
+ wy_log(LOG_ERR, _("GPGME: cannot create context: %s"),
gpgme_strerror(err));
return 1;
}
@@ -189,7 +189,7 @@ gpg_sign(gpgme_data_t * output, gpgme_data_t input, const char *sign_keys)
}
if (err && gpg_err_code(err) != GPG_ERR_EOF) {
- logmsg(LOG_ERR, _("GPGME: cannot list keys: %s"),
+ wy_log(LOG_ERR, _("GPGME: cannot list keys: %s"),
gpgme_strerror(err));
gpgme_release(ctx);
return 1;
@@ -197,7 +197,7 @@ gpg_sign(gpgme_data_t * output, gpgme_data_t input, const char *sign_keys)
err = gpgme_data_new(output);
if (err) {
- logmsg(LOG_ERR, _("%s: GPGME error: %s"),
+ wy_log(LOG_ERR, _("%s: GPGME error: %s"),
"gpgme_data_new", gpgme_strerror(err));
gpgme_release(ctx);
return 1;
@@ -209,7 +209,7 @@ gpg_sign(gpgme_data_t * output, gpgme_data_t input, const char *sign_keys)
err = gpgme_op_sign(ctx, input, *output, GPGME_SIG_MODE_CLEAR);
if (err) {
- logmsg(LOG_ERR, _("%s: GPGME error: %s"),
+ wy_log(LOG_ERR, _("%s: GPGME error: %s"),
"gpgme_op_sign", gpgme_strerror(err));
ret = 1;
} else {
@@ -242,24 +242,21 @@ sign_message(mu_message_t *pmsg, const char *key)
size_t size = 0;
size_t nread;
- if (wy_debug_level)
- logmsg(LOG_DEBUG, _("signing message as %s"), key);
+ wy_debug(1, (_("signing message as %s"), key));
if (wydawca_gpg_homedir) {
- if (wy_debug_level > 1)
- logmsg(LOG_DEBUG,
- _("setting GNUPG home directory: %s"),
- wydawca_gpg_homedir);
+ wy_debug(2, (_("setting GNUPG home directory: %s"),
+ wydawca_gpg_homedir));
setenv("GNUPGHOME", wydawca_gpg_homedir, 1);
}
if ((rc = mu_message_get_body(msg, &body))) {
- logmsg(LOG_ERR, "mu_message_get_body: %s", mu_strerror(rc));
+ wy_log(LOG_ERR, "mu_message_get_body: %s", mu_strerror(rc));
return 1;
}
if ((rc = mu_body_get_streamref(body, &bodystr))) {
- logmsg(LOG_ERR, "mu_message_get_stream: %s", mu_strerror(rc));
+ wy_log(LOG_ERR, "mu_message_get_stream: %s", mu_strerror(rc));
return 1;
}
@@ -268,7 +265,7 @@ sign_message(mu_message_t *pmsg, const char *key)
err = gpgme_data_new_from_cbs(&input, &cbs, &bodystr);
if (err) {
- logmsg(LOG_ERR, "gpgme_data_new_from_cbs: %s",
+ wy_log(LOG_ERR, "gpgme_data_new_from_cbs: %s",
gpgme_strerror(rc));
return 1;
}
@@ -279,7 +276,7 @@ sign_message(mu_message_t *pmsg, const char *key)
return 1;
if (gpgme_data_seek(output, 0, SEEK_SET) == -1) {
- logmsg(LOG_ERR, "gpgme_data_seek: %s", strerror(errno));
+ wy_log(LOG_ERR, "gpgme_data_seek: %s", strerror(errno));
return 1;
}
@@ -292,12 +289,12 @@ sign_message(mu_message_t *pmsg, const char *key)
rc = mu_stream_copy(ostr, istr, 0, NULL);
if (rc)
- logmsg(LOG_ERR, "mu_stream_copy: %s", mu_strerror(rc));
+ wy_log(LOG_ERR, "mu_stream_copy: %s", mu_strerror(rc));
else {
while ((nread = gpgme_data_read(output, buf, size)) > 0) {
rc = mu_stream_write(ostr, buf, nread, NULL);
if (rc) {
- logmsg(LOG_ERR, "mu_stream_write: %s",
+ wy_log(LOG_ERR, "mu_stream_write: %s",
mu_strerror(rc));
break;
}
@@ -332,7 +329,7 @@ mail_send_message(mu_address_t rcpt, const char *text, const char *signer_key)
rc = mu_stream_to_message(stream, &msg);
mu_stream_unref(stream);
if (rc) {
- logmsg(LOG_CRIT, _("cannot create message: %s"),
+ wy_log(LOG_CRIT, _("cannot create message: %s"),
mu_strerror(rc));
return;
}
@@ -366,7 +363,7 @@ mail_send_message(mu_address_t rcpt, const char *text, const char *signer_key)
if ((rc = mu_mailer_open(mailer, 0))) {
mu_url_t url = NULL;
mu_mailer_get_url(mailer, &url);
- logmsg(LOG_CRIT, _("opening mailer `%s' failed: %s"),
+ wy_log(LOG_CRIT, _("opening mailer `%s' failed: %s"),
url ? mu_url_to_string(url) : "(unknown URL)",
mu_strerror(rc));
return;
@@ -380,7 +377,7 @@ mail_send_message(mu_address_t rcpt, const char *text, const char *signer_key)
if (!dry_run_mode) {
rc = mu_mailer_send_message(mailer, msg, from_address, rcpt);
if (rc)
- logmsg(LOG_CRIT, _("cannot send message: %s"),
+ wy_log(LOG_CRIT, _("cannot send message: %s"),
mu_strerror(rc));
}
@@ -618,7 +615,7 @@ mod_mailutils_LTX_open(grecs_node_t *node)
if (!mailer && (rc = mu_mailer_create(&mailer, NULL))) {
const char *url = NULL;
mu_mailer_get_url_default(&url);
- logmsg(LOG_ERR,
+ wy_log(LOG_ERR,
_("cannot create default mailer `%s': %s"), url,
mu_strerror(rc));
}
@@ -842,7 +839,7 @@ t_notify(struct mailevt *evt, int ev, struct file_triplet const *trp)
}
if (!rcpt && evt->rcpt != notify_read) {
- logmsg(LOG_ERR,
+ wy_log(LOG_ERR,
_("not notifying %s (project %s) about %s: %s"),
ntfrcpt_str(evt->rcpt),
trp->project, notification_event_str(ev),
@@ -855,12 +852,12 @@ t_notify(struct mailevt *evt, int ev, struct file_triplet const *trp)
const char *s;
if (mu_address_sget_printable(rcpt, &s) == 0)
- logmsg(LOG_DEBUG,
+ wy_log(LOG_DEBUG,
_("notifying %s (project %s) about %s"),
s, trp->project,
notification_event_str(ev));
} else
- logmsg(LOG_DEBUG,
+ wy_log(LOG_DEBUG,
_("notifying message recipients (project %s) "
"about %s"),
trp->project, notification_event_str(ev));
@@ -868,7 +865,7 @@ t_notify(struct mailevt *evt, int ev, struct file_triplet const *trp)
msg = resolve_message_template(evt->msg);
if (!msg)
- logmsg(LOG_ERR, _("undefined message reference: %s"),
+ wy_log(LOG_ERR, _("undefined message reference: %s"),
evt->msg);
else {
text = triplet_expand_param(msg, trp);
@@ -893,7 +890,7 @@ mail_stats(struct mailevt *evt)
return;
if (!admin_address) {
- logmsg(LOG_ERR,
+ wy_log(LOG_ERR,
_("cannot mail statistics: admin-address not defined"));
return;
}
@@ -902,7 +899,7 @@ mail_stats(struct mailevt *evt)
const char *s;
if (mu_address_sget_printable(admin_address, &s) == 0)
- logmsg(LOG_DEBUG, _("sending stats to %s"), s);
+ wy_log(LOG_DEBUG, _("sending stats to %s"), s);
}
tc = timer_get_count() * 3;
@@ -915,7 +912,7 @@ mail_stats(struct mailevt *evt)
tmpl = resolve_message_template(admin_stat_message);
if (!tmpl) {
- logmsg(LOG_ERR, _("undefined message reference: %s"),
+ wy_log(LOG_ERR, _("undefined message reference: %s"),
admin_stat_message);
return;
}

Return to:

Send suggestions and report system problems to the System administrator.