diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-06-20 22:13:21 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-06-20 22:13:21 +0000 |
commit | 019338425afc502fc25aeb1896f404a6c0087a2e (patch) | |
tree | b665ce8f8ca23b03ea302f291776c2e804f3fab0 /src/util/configuration.c | |
parent | 1ad53c2941cf815064328f6a55f51bea291e7bed (diff) | |
download | gnunet-019338425afc502fc25aeb1896f404a6c0087a2e.tar.gz gnunet-019338425afc502fc25aeb1896f404a6c0087a2e.zip |
avoid excessive logging in config parsing
Diffstat (limited to 'src/util/configuration.c')
-rw-r--r-- | src/util/configuration.c | 45 |
1 files changed, 8 insertions, 37 deletions
diff --git a/src/util/configuration.c b/src/util/configuration.c index af5d43fd0..768a8d195 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c | |||
@@ -171,7 +171,6 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
171 | char *tag; | 171 | char *tag; |
172 | char *value; | 172 | char *value; |
173 | 173 | ||
174 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Deserializing config file\n"); | ||
175 | ret = GNUNET_OK; | 174 | ret = GNUNET_OK; |
176 | section = GNUNET_strdup (""); | 175 | section = GNUNET_strdup (""); |
177 | nr = 0; | 176 | nr = 0; |
@@ -253,9 +252,6 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
253 | value = &line[1]; | 252 | value = &line[1]; |
254 | GNUNET_free (section); | 253 | GNUNET_free (section); |
255 | section = GNUNET_strdup (value); | 254 | section = GNUNET_strdup (value); |
256 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
257 | "Config section `%s'\n", | ||
258 | section); | ||
259 | continue; | 255 | continue; |
260 | } | 256 | } |
261 | if (NULL != (eq = strchr (line, '='))) | 257 | if (NULL != (eq = strchr (line, '='))) |
@@ -281,7 +277,6 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
281 | value[strlen (value) - 1] = '\0'; | 277 | value[strlen (value) - 1] = '\0'; |
282 | value++; | 278 | value++; |
283 | } | 279 | } |
284 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Config value %s=\"%s\"\n", tag, value); | ||
285 | GNUNET_CONFIGURATION_set_value_string (cfg, section, tag, &value[i]); | 280 | GNUNET_CONFIGURATION_set_value_string (cfg, section, tag, &value[i]); |
286 | GNUNET_free (tag); | 281 | GNUNET_free (tag); |
287 | continue; | 282 | continue; |
@@ -293,7 +288,6 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
293 | ret = GNUNET_SYSERR; | 288 | ret = GNUNET_SYSERR; |
294 | break; | 289 | break; |
295 | } | 290 | } |
296 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Finished deserializing config\n"); | ||
297 | GNUNET_free_non_null (line_orig); | 291 | GNUNET_free_non_null (line_orig); |
298 | GNUNET_free (section); | 292 | GNUNET_free (section); |
299 | GNUNET_assert ( (GNUNET_OK != ret) || (r_bytes == size) ); | 293 | GNUNET_assert ( (GNUNET_OK != ret) || (r_bytes == size) ); |
@@ -320,12 +314,9 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
320 | int dirty; | 314 | int dirty; |
321 | int ret; | 315 | int ret; |
322 | 316 | ||
323 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
324 | "Asked to parse config file `%s'\n", | ||
325 | filename); | ||
326 | fn = GNUNET_STRINGS_filename_expand (filename); | 317 | fn = GNUNET_STRINGS_filename_expand (filename); |
327 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 318 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
328 | "Config file name expanded to `%s'\n", | 319 | "Asked to parse config file `%s'\n", |
329 | fn); | 320 | fn); |
330 | if (NULL == fn) | 321 | if (NULL == fn) |
331 | return GNUNET_SYSERR; | 322 | return GNUNET_SYSERR; |
@@ -334,7 +325,8 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
334 | GNUNET_DISK_file_size (fn, &fs64, GNUNET_YES, GNUNET_YES)) | 325 | GNUNET_DISK_file_size (fn, &fs64, GNUNET_YES, GNUNET_YES)) |
335 | { | 326 | { |
336 | LOG (GNUNET_ERROR_TYPE_WARNING, | 327 | LOG (GNUNET_ERROR_TYPE_WARNING, |
337 | "Error while determining the file size of %s\n", fn); | 328 | "Error while determining the file size of `%s'\n", |
329 | fn); | ||
338 | GNUNET_free (fn); | 330 | GNUNET_free (fn); |
339 | return GNUNET_SYSERR; | 331 | return GNUNET_SYSERR; |
340 | } | 332 | } |
@@ -349,7 +341,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
349 | if (fs != GNUNET_DISK_fn_read (fn, mem, fs)) | 341 | if (fs != GNUNET_DISK_fn_read (fn, mem, fs)) |
350 | { | 342 | { |
351 | LOG (GNUNET_ERROR_TYPE_WARNING, | 343 | LOG (GNUNET_ERROR_TYPE_WARNING, |
352 | "Error while reading file %s\n", | 344 | _("Error while reading file `%s'\n"), |
353 | fn); | 345 | fn); |
354 | GNUNET_free (fn); | 346 | GNUNET_free (fn); |
355 | GNUNET_free (mem); | 347 | GNUNET_free (mem); |
@@ -505,7 +497,8 @@ GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
505 | GNUNET_free (fn); | 497 | GNUNET_free (fn); |
506 | GNUNET_free (cfg_buf); | 498 | GNUNET_free (cfg_buf); |
507 | LOG (GNUNET_ERROR_TYPE_WARNING, | 499 | LOG (GNUNET_ERROR_TYPE_WARNING, |
508 | "Writing configration to file: %s failed\n", filename); | 500 | "Writing configration to file `%s' failed\n", |
501 | filename); | ||
509 | cfg->dirty = GNUNET_SYSERR; /* last write failed */ | 502 | cfg->dirty = GNUNET_SYSERR; /* last write failed */ |
510 | return GNUNET_SYSERR; | 503 | return GNUNET_SYSERR; |
511 | } | 504 | } |
@@ -980,10 +973,6 @@ GNUNET_CONFIGURATION_get_value_string (const struct GNUNET_CONFIGURATION_Handle | |||
980 | { | 973 | { |
981 | struct ConfigEntry *e; | 974 | struct ConfigEntry *e; |
982 | 975 | ||
983 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
984 | "Asked to retrieve string `%s' in section `%s'\n", | ||
985 | option, | ||
986 | section); | ||
987 | if ( (NULL == (e = find_entry (cfg, section, option))) || | 976 | if ( (NULL == (e = find_entry (cfg, section, option))) || |
988 | (NULL == e->val) ) | 977 | (NULL == e->val) ) |
989 | { | 978 | { |
@@ -1149,7 +1138,8 @@ expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1149 | return orig; | 1138 | return orig; |
1150 | } | 1139 | } |
1151 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1140 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1152 | "Asked to $-expand %s\n", orig); | 1141 | "Asked to $-expand %s\n", |
1142 | orig); | ||
1153 | if ('$' != orig[0]) | 1143 | if ('$' != orig[0]) |
1154 | { | 1144 | { |
1155 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1145 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1232,14 +1222,8 @@ expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1232 | start, | 1222 | start, |
1233 | &prefix)) | 1223 | &prefix)) |
1234 | { | 1224 | { |
1235 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1236 | "Filename for `%s' is not in PATHS config section\n", | ||
1237 | start); | ||
1238 | if (NULL == (env = getenv (start))) | 1225 | if (NULL == (env = getenv (start))) |
1239 | { | 1226 | { |
1240 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1241 | "`%s' is not an environment variable\n", | ||
1242 | start); | ||
1243 | /* try default */ | 1227 | /* try default */ |
1244 | def = expand_dollar (cfg, def, depth + 1); | 1228 | def = expand_dollar (cfg, def, depth + 1); |
1245 | env = def; | 1229 | env = def; |
@@ -1258,9 +1242,6 @@ expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1258 | prefix = GNUNET_strdup (env); | 1242 | prefix = GNUNET_strdup (env); |
1259 | } | 1243 | } |
1260 | prefix = GNUNET_CONFIGURATION_expand_dollar (cfg, prefix); | 1244 | prefix = GNUNET_CONFIGURATION_expand_dollar (cfg, prefix); |
1261 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1262 | "Prefix is `%s'\n", | ||
1263 | prefix); | ||
1264 | if ( (erased_pos) && ('}' != erased_char) ) | 1245 | if ( (erased_pos) && ('}' != erased_char) ) |
1265 | { | 1246 | { |
1266 | len = strlen (prefix) + 1; | 1247 | len = strlen (prefix) + 1; |
@@ -1274,9 +1255,6 @@ expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1274 | GNUNET_free_non_null (def); | 1255 | GNUNET_free_non_null (def); |
1275 | GNUNET_free (prefix); | 1256 | GNUNET_free (prefix); |
1276 | GNUNET_free (orig); | 1257 | GNUNET_free (orig); |
1277 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1278 | "Expanded to `%s'\n", | ||
1279 | result); | ||
1280 | return result; | 1258 | return result; |
1281 | } | 1259 | } |
1282 | 1260 | ||
@@ -1338,10 +1316,6 @@ GNUNET_CONFIGURATION_get_value_filename (const struct GNUNET_CONFIGURATION_Handl | |||
1338 | { | 1316 | { |
1339 | char *tmp; | 1317 | char *tmp; |
1340 | 1318 | ||
1341 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1342 | "Asked to retrieve filename `%s' in section `%s'\n", | ||
1343 | option, | ||
1344 | section); | ||
1345 | if (GNUNET_OK != | 1319 | if (GNUNET_OK != |
1346 | GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &tmp)) | 1320 | GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &tmp)) |
1347 | { | 1321 | { |
@@ -1350,12 +1324,9 @@ GNUNET_CONFIGURATION_get_value_filename (const struct GNUNET_CONFIGURATION_Handl | |||
1350 | *value = NULL; | 1324 | *value = NULL; |
1351 | return GNUNET_SYSERR; | 1325 | return GNUNET_SYSERR; |
1352 | } | 1326 | } |
1353 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Retrieved filename `%s', $-expanding\n", tmp); | ||
1354 | tmp = GNUNET_CONFIGURATION_expand_dollar (cfg, tmp); | 1327 | tmp = GNUNET_CONFIGURATION_expand_dollar (cfg, tmp); |
1355 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Expanded to filename `%s', *nix-expanding\n", tmp); | ||
1356 | *value = GNUNET_STRINGS_filename_expand (tmp); | 1328 | *value = GNUNET_STRINGS_filename_expand (tmp); |
1357 | GNUNET_free (tmp); | 1329 | GNUNET_free (tmp); |
1358 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Filename result is `%s'\n", *value); | ||
1359 | if (*value == NULL) | 1330 | if (*value == NULL) |
1360 | return GNUNET_SYSERR; | 1331 | return GNUNET_SYSERR; |
1361 | return GNUNET_OK; | 1332 | return GNUNET_OK; |