diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-01-20 19:19:53 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-01-20 19:19:53 +0100 |
commit | 16354eff99fe673f912862138c4dce30bbd0afb5 (patch) | |
tree | f08b5fd25de0e3b34e3ea50062028af9e953e8c1 /conf-parser.c | |
parent | 5899f3b7f62151dade30010370fb5d2bcdb93d3a (diff) |
make use of logging API wherever appropriate
Diffstat (limited to 'conf-parser.c')
-rw-r--r-- | conf-parser.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/conf-parser.c b/conf-parser.c index 3a7da7960c..2ea6911257 100644 --- a/conf-parser.c +++ b/conf-parser.c @@ -10,6 +10,7 @@ #include "util.h" #include "macro.h" #include "strv.h" +#include "log.h" #define WHITESPACE " \t\n" #define COMMENTS "#;\n" @@ -44,7 +45,7 @@ static int next_assignment( return t->parse(filename, line, section, lvalue, rvalue, t->data, userdata); } - fprintf(stderr, "[%s:%u] Unknown lvalue '%s' in section '%s'.\n", filename, line, lvalue, strna(section)); + log_error("[%s:%u] Unknown lvalue '%s' in section '%s'.", filename, line, lvalue, strna(section)); return -EBADMSG; } @@ -122,7 +123,7 @@ static int parse_line(const char *filename, unsigned line, char **section, const assert(k > 0); if (b[k-1] != ']') { - fprintf(stderr, "[%s:%u] Invalid section header.\n", filename, line); + log_error("[%s:%u] Invalid section header.", filename, line); return -EBADMSG; } @@ -151,7 +152,7 @@ static int parse_line(const char *filename, unsigned line, char **section, const } if (!(e = strchr(b, '='))) { - fprintf(stderr, "[%s:%u] Missing '='.\n", filename, line); + log_error("[%s:%u] Missing '='.", filename, line); return -EBADMSG; } @@ -173,7 +174,7 @@ int config_parse(const char *filename, const char* const * sections, const Confi if (!(f = fopen(filename, "re"))) { r = -errno; - fprintf(stderr, "Failed to open configuration file '%s': %s\n", filename, strerror(-r)); + log_error("Failed to open configuration file '%s': %s", filename, strerror(-r)); goto finish; } @@ -185,7 +186,7 @@ int config_parse(const char *filename, const char* const * sections, const Confi break; r = -errno; - fprintf(stderr, "Failed to read configuration file '%s': %s\n", filename, strerror(-r)); + log_error("Failed to read configuration file '%s': %s", filename, strerror(-r)); goto finish; } @@ -222,7 +223,7 @@ int config_parse_int( assert(data); if ((r = safe_atoi(rvalue, i)) < 0) { - fprintf(stderr, "[%s:%u] Failed to parse numeric value: %s\n", filename, line, rvalue); + log_error("[%s:%u] Failed to parse numeric value: %s", filename, line, rvalue); return r; } @@ -247,7 +248,7 @@ int config_parse_unsigned( assert(data); if ((r = safe_atou(rvalue, u)) < 0) { - fprintf(stderr, "[%s:%u] Failed to parse numeric value: %s\n", filename, line, rvalue); + log_error("[%s:%u] Failed to parse numeric value: %s", filename, line, rvalue); return r; } @@ -273,7 +274,7 @@ int config_parse_size( assert(data); if ((r = safe_atou(rvalue, &u)) < 0) { - fprintf(stderr, "[%s:%u] Failed to parse numeric value: %s\n", filename, line, rvalue); + log_error("[%s:%u] Failed to parse numeric value: %s", filename, line, rvalue); return r; } @@ -299,7 +300,7 @@ int config_parse_bool( assert(data); if ((k = parse_boolean(rvalue)) < 0) { - fprintf(stderr, "[%s:%u] Failed to parse boolean value: %s\n", filename, line, rvalue); + log_error("[%s:%u] Failed to parse boolean value: %s", filename, line, rvalue); return k; } |