diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-02-06 13:39:58 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-02-06 13:39:58 +0300 |
commit | a3c3fb96d13f2cbfc5ab984c1886441ec0e9b47b (patch) | |
tree | 12233b2d521607537f451d22b6e818428ee272e8 /src/cfg_utils.c | |
parent | bf6f2838403722ea571daaeec5981831313d474b (diff) | |
download | rspamd-a3c3fb96d13f2cbfc5ab984c1886441ec0e9b47b.tar.gz rspamd-a3c3fb96d13f2cbfc5ab984c1886441ec0e9b47b.zip |
* Move config parse errors from stderr output to standart logging functions
Diffstat (limited to 'src/cfg_utils.c')
-rw-r--r-- | src/cfg_utils.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/cfg_utils.c b/src/cfg_utils.c index 68c1a1174..7e1e74b28 100644 --- a/src/cfg_utils.c +++ b/src/cfg_utils.c @@ -632,6 +632,41 @@ parse_regexp (memory_pool_t *pool, char *line) return result; } +void +parse_err (const char *fmt, ...) +{ + va_list aq; + char logbuf[BUFSIZ], readbuf[32]; + int r; + + va_start (aq, fmt); + g_strlcpy (readbuf, yytext, sizeof (readbuf)); + + r = snprintf (logbuf, sizeof (logbuf), "config file parse error! line: %d, text: %s, reason: ", yylineno, readbuf); + r += vsnprintf (logbuf + r, sizeof (logbuf) - r, fmt, aq); + + va_end (aq); + g_error ("%s", logbuf); +} + +void +parse_warn (const char *fmt, ...) +{ + va_list aq; + char logbuf[BUFSIZ], readbuf[32]; + int r; + + va_start (aq, fmt); + g_strlcpy (readbuf, yytext, sizeof (readbuf)); + + r = snprintf (logbuf, sizeof (logbuf), "config file parse warning! line: %d, text: %s, reason: ", yylineno, readbuf); + r += vsnprintf (logbuf + r, sizeof (logbuf) - r, fmt, aq); + + va_end (aq); + g_warning ("%s", logbuf); +} + + /* * vi:ts=4 */ |