Changeset 601028a0cf532695cb9ad0c413614254754dcf16

Show
Ignore:
Timestamp:
03/02/08 03:12:43 (7 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
  • src/noit_conf.c

    r5f388ee r601028a  
    4444}; 
    4545 
     46void 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} 
     56void 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} 
    4670void noit_conf_init(const char *toplevel) { 
    4771  int i; 
    4872  char keystr[256]; 
     73  xmlSetGenericErrorFunc(noit_error, noit_conf_xml_error_func); 
     74  xmlSetStructuredErrorFunc(noit_error, noit_conf_xml_error_ext_func); 
    4975  for(i = 0; config_info[i].key != NULL; i++) { 
    5076    snprintf(keystr, sizeof(keystr), config_info[i].key, toplevel); 
     
    339365  char *str; 
    340366  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; 
    342369    else *value = noit_false; 
    343370    return 1;