Changeset 601028a0cf532695cb9ad0c413614254754dcf16
- Timestamp:
- 03/02/08 03:12:43
(5 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1204427563 +0000
- git-parent:
[bd54e8d25218b7d09076b7b541c108a2a68fe992]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1204427563 +0000
- Message:
funnel XML errors through the noit_log framework. -- allow 'on' as a boolean true
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r5f388ee |
r601028a |
|
| 44 | 44 | }; |
|---|
| 45 | 45 | |
|---|
| | 46 | void noit_conf_xml_error_func(void *ctx, const char *format, ...) { |
|---|
| | 47 | struct timeval __now; |
|---|
| | 48 | noit_log_stream_t ls = ctx; |
|---|
| | 49 | va_list arg; |
|---|
| | 50 | if(!ls) return; |
|---|
| | 51 | va_start(arg, format); |
|---|
| | 52 | gettimeofday(&__now, NULL); |
|---|
| | 53 | noit_vlog(ls, &__now, __FILE__, __LINE__, format, arg); |
|---|
| | 54 | va_end(arg); |
|---|
| | 55 | } |
|---|
| | 56 | void noit_conf_xml_error_ext_func(void *ctx, xmlErrorPtr err) { |
|---|
| | 57 | struct timeval __now; |
|---|
| | 58 | noit_log_stream_t ls = ctx; |
|---|
| | 59 | if(!ls) return; |
|---|
| | 60 | gettimeofday(&__now, NULL); |
|---|
| | 61 | if(err->file) |
|---|
| | 62 | noit_log(ls, &__now, err->file, err->line, |
|---|
| | 63 | "XML error [%d/%d] in %s on line %d %s\n", |
|---|
| | 64 | err->domain, err->code, err->file, err->line, err->message); |
|---|
| | 65 | else |
|---|
| | 66 | noit_log(ls, &__now, err->file, err->line, |
|---|
| | 67 | "XML error [%d/%d] %s\n", |
|---|
| | 68 | err->domain, err->code, err->message); |
|---|
| | 69 | } |
|---|
| 46 | 70 | void noit_conf_init(const char *toplevel) { |
|---|
| 47 | 71 | int i; |
|---|
| 48 | 72 | char keystr[256]; |
|---|
| | 73 | xmlSetGenericErrorFunc(noit_error, noit_conf_xml_error_func); |
|---|
| | 74 | xmlSetStructuredErrorFunc(noit_error, noit_conf_xml_error_ext_func); |
|---|
| 49 | 75 | for(i = 0; config_info[i].key != NULL; i++) { |
|---|
| 50 | 76 | snprintf(keystr, sizeof(keystr), config_info[i].key, toplevel); |
|---|
| … | … | |
| 339 | 365 | char *str; |
|---|
| 340 | 366 | if(_noit_conf_get_string(section,NULL,path,&str)) { |
|---|
| 341 | | if(!strcasecmp(str, "true")) *value = noit_true; |
|---|
| | 367 | if(!strcasecmp(str, "true") || |
|---|
| | 368 | !strcasecmp(str, "on")) *value = noit_true; |
|---|
| 342 | 369 | else *value = noit_false; |
|---|
| 343 | 370 | return 1; |
|---|