Changeset 288
- Timestamp:
- 06/03/10 10:07:57 (20 months ago)
- Location:
- trunk/src
- Files:
-
- 4 modified
-
ows/ows.c (modified) (4 diffs)
-
ows/ows_error.c (modified) (1 diff)
-
ows_api.h (modified) (1 diff)
-
wfs/wfs_error.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ows/ows.c
r284 r288 249 249 250 250 251 void ows_log(ows *o, int log_level, const char *log) 252 { 253 if (!o->log) return; 254 255 if (log_level == 1) fprintf(o->log, "[ERROR] %s\n", log); 256 else if (log_level == 2) fprintf(o->log, "[EVENT] %s\n", log); 257 else if (log_level == 3) fprintf(o->log, "[QUERY] %s\n", log); 258 else if (log_level == 4) fprintf(o->log, "[DEBUG] %s\n", log); 259 } 260 261 251 262 void ows_usage(ows * o) 252 263 { … … 323 334 o->log = fopen(o->log_file->buf, "a"); 324 335 325 if (!o->exit && o->log) fprintf(o->log, "== TINYOWS STARTUP == \n");336 if (!o->exit) ows_log(o, 2, "== TINYOWS STARTUP =="); 326 337 327 338 /* Connect the ows to the database */ 328 339 if (!o->exit) ows_pg(o, o->pg_dsn->buf); 329 if (!o->exit && o->log) fprintf(o->log, "== Connection PostGIS == \n");340 if (!o->exit) ows_log(o, 2, "== Connection PostGIS =="); 330 341 331 342 /* Fill layers storage metadata */ 332 343 if (!o->exit) ows_layers_storage_fill(o); 333 if (!o->exit && o->log) fprintf(o->log, "== Filling Storage == \n");344 if (!o->exit) ows_log(o, 2, "== Filling Storage =="); 334 345 335 346 336 347 337 348 #if TINYOWS_FCGI 338 if ( o->log) fprintf(o->log, "== FCGI START == \n");349 if (!o->exit) ows_log(o, 2, "== FCGI START =="); 339 350 while (FCGI_Accept() >= 0) 340 351 { … … 345 356 346 357 /* Log input query if asked */ 347 if (o->log && query) 348 fprintf(o->log, "[QUERY]\n%s\n", query); 358 if (!o->exit) ows_log(o, 3, query); 349 359 350 360 if (query == NULL || strlen(query) == 0) { … … 418 428 } 419 429 420 if (o->log) fprintf(o->log, "---\n"); 430 if (cgi_method_post() && query) free(query); /* We allocated memory only on post case */ 431 ows_log(o, 2, "== End QUERY =="); 421 432 #if TINYOWS_FCGI 422 433 o->exit = false; 423 if (o->log) fprintf(o->log, "== FCGI SHUTDOWN == \n");424 }434 } 435 ows_log(o, 2, "== FCGI SHUTDOWN =="); 425 436 OS_LibShutdown(); 426 437 #endif 427 if (o->log) fprintf(o->log, "== TINYOWS SHUTDOWN == \n");438 ows_log(o, 2, "== TINYOWS SHUTDOWN =="); 428 439 if (o->log) fclose (o->log); 429 440 ows_free(o); -
trunk/src/ows/ows_error.c
r278 r288 78 78 o->exit = true; 79 79 80 if (o->log != NULL) 81 fprintf(o->log, "[ERROR] {%s:%s} %s\n", 82 ows_error_code_string(code), locator, message); 80 ows_log(o, 1, message); 83 81 84 82 fprintf(o->output, "Content-Type: application/xml\n\n"); -
trunk/src/ows_api.h
r262 r288 200 200 void ows_layers_storage_fill(ows * o); 201 201 void ows_layers_storage_flush(ows * o, FILE * output); 202 void ows_log(ows *o, int log_level, const char *log); -
trunk/src/wfs/wfs_error.c
r278 r288 71 71 o->exit = true; 72 72 73 if (o->log != NULL) 74 fprintf(o->log, "[ERROR] {%s:%s} %s\n", 75 wfs_error_code_string(code), locator, message); 73 ows_log(o, 1, message); 76 74 77 75 fprintf(o->output, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); … … 103 101 o->exit = true; 104 102 105 if (o->log != NULL) 106 fprintf(o->log, "[ERROR] {%s:%s} %s\n", 107 wfs_error_code_string(code), locator, message); 103 ows_log(o, 1, message); 108 104 109 105 fprintf(o->output, "<?xml version='1.0' encoding='UTF-8'?>\n");