replace printf -> INFO
authorTero Marttila <terom@fixme.fi>
Thu, 26 Jun 2008 03:31:59 +0300
changeset 25 a1e271de54c2
parent 24 8307d28329ae
child 26 6d615203d963
replace printf -> INFO

committer: Tero Marttila <terom@fixme.fi>
common.h
render_remote.c
web_main.c
--- a/common.h	Thu Jun 26 02:57:20 2008 +0300
+++ b/common.h	Thu Jun 26 03:31:59 2008 +0300
@@ -48,8 +48,12 @@
 #endif
 
 // default is to enable INFO
-#ifndef INFO_ENABLED
-#define INFO_ENABLED 1
+#ifdef INFO_DISABLED
+    #define INFO_ENABLED 0
+#else
+    #ifndef INFO_ENABLED
+        #define INFO_ENABLED 1
+    #endif
 #endif
 
 #if INFO_ENABLED
--- a/render_remote.c	Thu Jun 26 02:57:20 2008 +0300
+++ b/render_remote.c	Thu Jun 26 03:31:59 2008 +0300
@@ -187,8 +187,6 @@
     if (!(node_info = remote_pool_get(pool_info)))
         ERROR("remote_pool_get");
 
-    printf("remote_node render load: %d/%d\n", node_info->current_load, node_info->parallel_renders);
-
     // alloc the remote render ctx
     if (!(ctx = calloc(1, sizeof(*ctx))))
         ERROR("calloc");
--- a/web_main.c	Thu Jun 26 02:57:20 2008 +0300
+++ b/web_main.c	Thu Jun 26 03:31:59 2008 +0300
@@ -73,7 +73,7 @@
 
     ctx->headers_sent = 1;
 
-    printf("render [%p]: sent headers\n", ctx);
+    INFO("render [%p]: sent headers", ctx);
 }
 
 static void _render_data (struct evbuffer *buf, void *arg) {
@@ -86,7 +86,7 @@
     // check if we are paused
     if (ctx->paused) {
         // we are waiting for the HTTP send buffer to clear, so keep the data in the render buffer
-        printf("render [%p]: delaying data: %zu:%zu bytes\n", ctx, buf_size, ctx->bytes_sent);
+        INFO("render [%p]: delaying data: %zu:%zu bytes", ctx, buf_size, ctx->bytes_sent);
 
         return;
     }
@@ -94,7 +94,7 @@
     // move chunk to http buffers
     evhttp_send_reply_chunk(ctx->http_request, buf);
 
-    printf("render [%p]: enqueued chunk: %zu/%zu bytes\n", ctx, buf_size, ctx->bytes_sent);
+    INFO("render [%p]: enqueued chunk: %zu/%zu bytes", ctx, buf_size, ctx->bytes_sent);
 
     // mark ourself as paused until httpd tells us to continue
     ctx->paused = 1;
@@ -109,7 +109,7 @@
     // send end
     evhttp_send_reply_end(ctx->http_request);
 
-    printf("render [%p]: done: %zu bytes\n", ctx, ctx->bytes_sent);
+    INFO("render [%p]: done: %zu bytes", ctx, ctx->bytes_sent);
         
     // the request is now done, clean up
     _render_cleanup(ctx);
@@ -126,7 +126,7 @@
         evhttp_send_error(ctx->http_request, 500, "Internal Server Error");
     }
     
-    printf("render [%p]: failed\n", ctx);
+    INFO("render [%p]: failed", ctx);
 
     _render_cleanup(ctx);
 }
@@ -134,7 +134,7 @@
 static void _render_http_lost (struct evhttp_request *req, void *arg) {
     struct render_request *ctx = arg;
 
-    printf("render [%p]: lost http connection\n", ctx);
+    INFO("render [%p]: lost http connection", ctx);
 
     // cancel
     render_remote_cancel(ctx->render_info);
@@ -146,7 +146,7 @@
 static void _render_http_written (struct evhttp_request *request, void *arg) {
     struct render_request *ctx = arg;
     
-    printf("render [%p]: http available for write\n", ctx);
+    INFO("render [%p]: http available for write", ctx);
     
     // unpause ourself
     ctx->paused = 0;
@@ -193,7 +193,7 @@
     // set close cb
     evhttp_set_reply_abortcb(request, &_render_http_lost, ctx);
     
-    printf("render [%p]: started\n", ctx);
+    INFO("render [%p]: started", ctx);
     
     return;
 
@@ -226,7 +226,7 @@
     http_qarg_parse(request, qarg_spec);
 
     // request log
-    printf("REQ: [%s:%d] method=%d, uri=%s, img_w=%lu, img_h=%lu\n", peer_address, peer_port, evhttp_request_get_type(request), uri, img_w, img_h);
+    INFO("REQ: [%s:%d] method=%d, uri=%s, img_w=%lu, img_h=%lu", peer_address, peer_port, evhttp_request_get_type(request), uri, img_w, img_h);
     
     // do it
     _http_render_execute(request, img_w, img_h);
@@ -235,7 +235,7 @@
 struct event ev_sigint;
 
 void sigint_handler (int signal, short event, void *arg) {
-    printf("SIGINT: shutting down\n");
+    INFO("SIGINT: shutting down");
     
     if (event_base_loopexit(ev_base, NULL))
         err_exit("event_loopexit");
@@ -314,7 +314,7 @@
         FATAL("No remote render nodes given");
     
 
-    printf("Registered %d render nodes in our pool\n", pool_size);
+    INFO("Registered %d render nodes in our pool", pool_size);
     
     // per default it is enabled
     if (!enable_debug)
@@ -337,13 +337,13 @@
     evhttp_set_cb(http_server, "/render", &http_render, NULL);
 
     // we shall now run
-    printf("RUN 0.0.0.0:8117\n");
+    INFO("RUN 0.0.0.0:8117");
     
     // run the libevent mainloop
     if (event_base_dispatch(ev_base))
         WARNING("event_dispatch");
 
-    printf("SHUTDOWN\n");
+    INFO("SHUTDOWN");
     
     // clean up
     signals_deinit();