Bugfix (complements 6bd92d3c).
* libmu_sieve/util.c (mu_sieve_error, mu_sieve_debug) (mu_sieve_log_action): Format location only if locus.mu_file is not NULL.
Showing
1 changed file
with
12 additions
and
8 deletions
... | @@ -209,8 +209,10 @@ mu_sieve_error (mu_sieve_machine_t mach, const char *fmt, ...) | ... | @@ -209,8 +209,10 @@ mu_sieve_error (mu_sieve_machine_t mach, const char *fmt, ...) |
209 | va_list ap; | 209 | va_list ap; |
210 | 210 | ||
211 | va_start (ap, fmt); | 211 | va_start (ap, fmt); |
212 | mu_stream_printf (mach->errstream, "\033s<%d>\033O<%d>\033f<%u>%s\033l<%u>", | 212 | mu_stream_printf (mach->errstream, "\033s<%d>", MU_LOG_ERROR); |
213 | MU_LOG_ERROR, MU_LOGMODE_LOCUS, | 213 | if (mach->locus.mu_file) |
214 | mu_stream_printf (mach->errstream, "\033O<%d>\033f<%u>%s\033l<%u>", | ||
215 | MU_LOGMODE_LOCUS, | ||
214 | strlen (mach->locus.mu_file), mach->locus.mu_file, | 216 | strlen (mach->locus.mu_file), mach->locus.mu_file, |
215 | mach->locus.mu_line); | 217 | mach->locus.mu_line); |
216 | if (mach->identifier) | 218 | if (mach->identifier) |
... | @@ -232,9 +234,10 @@ mu_sieve_debug (mu_sieve_machine_t mach, const char *fmt, ...) | ... | @@ -232,9 +234,10 @@ mu_sieve_debug (mu_sieve_machine_t mach, const char *fmt, ...) |
232 | va_list ap; | 234 | va_list ap; |
233 | 235 | ||
234 | va_start (ap, fmt); | 236 | va_start (ap, fmt); |
235 | mu_stream_printf (mach->errstream, | 237 | mu_stream_printf (mach->errstream, "\033s<%d>", MU_LOG_DEBUG); |
236 | "\033s<%d>\033O<%d>\033f<%u>%s\033l<%u>", | 238 | if (mach->locus.mu_file) |
237 | MU_LOG_DEBUG, MU_LOGMODE_LOCUS, | 239 | mu_stream_printf (mach->errstream, "\033O<%d>\033f<%u>%s\033l<%u>", |
240 | MU_LOGMODE_LOCUS, | ||
238 | strlen (mach->locus.mu_file), mach->locus.mu_file, | 241 | strlen (mach->locus.mu_file), mach->locus.mu_file, |
239 | mach->locus.mu_line); | 242 | mach->locus.mu_line); |
240 | mu_stream_vprintf (mach->errstream, fmt, ap); | 243 | mu_stream_vprintf (mach->errstream, fmt, ap); |
... | @@ -251,9 +254,10 @@ mu_sieve_log_action (mu_sieve_machine_t mach, const char *action, | ... | @@ -251,9 +254,10 @@ mu_sieve_log_action (mu_sieve_machine_t mach, const char *action, |
251 | if (!mach->logger) | 254 | if (!mach->logger) |
252 | return; | 255 | return; |
253 | va_start (ap, fmt); | 256 | va_start (ap, fmt); |
254 | mu_stream_printf (mach->errstream, | 257 | mu_stream_printf (mach->errstream, "\033s<%d>", MU_LOG_INFO); |
255 | "\033s<%d>\033O<%d>\033f<%u>%s\033l<%u>", | 258 | if (mach->locus.mu_file) |
256 | MU_LOG_INFO, MU_LOGMODE_LOCUS, | 259 | mu_stream_printf (mach->errstream, "\033O<%d>\033f<%u>%s\033l<%u>", |
260 | MU_LOGMODE_LOCUS, | ||
257 | strlen (mach->locus.mu_file), mach->locus.mu_file, | 261 | strlen (mach->locus.mu_file), mach->locus.mu_file, |
258 | mach->locus.mu_line); | 262 | mach->locus.mu_line); |
259 | mach->logger (mach->data, mach->errstream, mach->msgno, mach->msg, | 263 | mach->logger (mach->data, mach->errstream, mach->msgno, mach->msg, | ... | ... |
-
Please register or sign in to post a comment