From 72093df9fdf281ccd581baf5993bdc2ec6957342 Mon Sep 17 00:00:00 2001
From: David Walter Seikel
Date: Sun, 3 Jan 2016 20:35:53 +1000
Subject: Clean up logging, removing most of the printf's.

---
 src/LuaSL/LuaSL_main.c    | 14 +++++-----
 src/extantz/camera.c      | 10 +++----
 src/extantz/extantz.c     |  6 ++---
 src/extantz/gears.c       |  5 ++--
 src/libraries/LumbrJack.c |  2 +-
 src/libraries/Runnr.c     | 60 ++++++++++++++++++++---------------------
 src/libraries/SledjHamr.c | 68 ++++++++++++++++++++++-------------------------
 src/love/love.c           | 12 ++++-----
 8 files changed, 86 insertions(+), 91 deletions(-)

diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c
index a412027..7e9d935 100644
--- a/src/LuaSL/LuaSL_main.c
+++ b/src/LuaSL/LuaSL_main.c
@@ -73,7 +73,7 @@ void send2server(script *me, const char *message)
 {
     gameGlobals *ourGlobals = me->data;
 
-//printf("GOT MESSAGE from script %s - '%s'\n", me->name, message);
+//PD("GOT MESSAGE from script %s - '%s'", me->name, message);
 
     if (0 == strncmp(message, "llSleep(", 8))
 	ecore_timer_add(atof(&(message)[8]), _sleep_timer_cb, me);
@@ -223,7 +223,7 @@ static Eina_Bool parser(void *data, Connection *connection, char *SID, char *com
   gameGlobals *ourGlobals = data;
   char buf[PATH_MAX];
 
-PW("COMMAND - %s", command);
+//PD("COMMAND - %s", command);
     if (0 == strncmp(command, "compile(", 8))
     {
 	char *temp;
@@ -244,7 +244,7 @@ PW("COMMAND - %s", command);
 	compiler->doConstants = FALSE;
 	compiler->parser = (compileCb) compileLSL;
 	compiler->cb = _compileCb;
-PI("Compiling script %s", file);
+PD("Compiling script %s", file);
 	compileScript(compiler, COMPILE_THREADED);
     }
     else if (0 == strncmp(command, "run(", 4))
@@ -266,14 +266,16 @@ PI("Compiling script %s", file);
 	me = getScript(SID);
 	if (me)
 	{
-PI("Running script %s", me->fileName);
+PD("Running script %s", me->fileName);
 	    runScript(me);
 	    releaseScript(me);
 	}
+	else
+	    PE("Failed to run script %s", me->fileName);
     }
     else if (0 == strcmp(command, "exit()"))
     {
-	PD("Told to exit.");
+	PI("Told to exit.");
 	ecore_main_loop_quit();
     }
     else
@@ -319,7 +321,7 @@ int main(int argc, char **argv)
       }
       else if (ecore_con_init())
       {
-        PD("LuaSL is about to try creating a LuaSL server.");
+//        PD("LuaSL is about to try creating a LuaSL server.");
 	if (openArms("LuaSL", ourGlobals.address, ourGlobals.port, &ourGlobals, NULL, NULL, NULL, parser))
 	{
 	    Eina_Iterator *scripts;
diff --git a/src/extantz/camera.c b/src/extantz/camera.c
index 4bcf64c..123285c 100644
--- a/src/extantz/camera.c
+++ b/src/extantz/camera.c
@@ -92,9 +92,9 @@ static void _on_camera_input_down(void *data, Evas *evas, Evas_Object *obj, void
     else if (0 == strcmp(ev->key, "Home"))	move->x = -2.0;
     else if (0 == strcmp(ev->key, "End"))	move->x = 2.0;
     else if (0 == strcmp(ev->key, "space"))	move->jump = 1.0;
-    else printf("Unexpected down keystroke - %s\n", ev->key);
+    else PW("Unexpected down keystroke - %s", ev->key);
   }
-  else printf("Camera input not ready\n");
+  else PE("Camera input not ready");
 }
 
 /* SL / OS camera controls
@@ -184,9 +184,9 @@ static void _on_camera_input_up(void *data, Evas *evas, Evas_Object *obj, void *
     else if (0 == strcmp(ev->key, "Home"))	move->x = 0.0;
     else if (0 == strcmp(ev->key, "End"))	move->x = 0.0;
     else if (0 == strcmp(ev->key, "space"))	move->jump = 0.0;
-    else printf("Unexpected up keystroke - %s\n", ev->key);
+    else PW("Unexpected up keystroke - %s", ev->key);
   }
-  else printf("Camera input not ready\n");
+  else PE("Camera input not ready");
 }
 
 /* While it's true that image is an Elm image, seems this Elm input event callback doesn't work.
@@ -212,7 +212,7 @@ static Eina_Bool _cb_event_GL(void *data, Evas_Object *obj, Evas_Object *src, Ev
     }
 
     default :
-      printf("Unknown GL input event.\n");
+      PE("Unknown GL input event.");
   }
 
   return processed;
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c
index c2dadba..840dfec 100644
--- a/src/extantz/extantz.c
+++ b/src/extantz/extantz.c
@@ -42,7 +42,6 @@ static Eina_Bool clientParser(void *data, Connection *connection, char *SID, cha
     || (0 == strncmp(command, "llSay(", 6))
     || (0 == strncmp(command, "llShout(", 8)))
   {
-
     sprintf(buf, "%s: %s", SID, command);
     if (ourGlobals->purkle)
     {
@@ -53,7 +52,7 @@ static Eina_Bool clientParser(void *data, Connection *connection, char *SID, cha
       push_lua(ourGlobals->purkle->L, "@ ( $ )", _P, "append", buf, 0);
     }
     else
-      PW("No purkle to put - %s", buf);
+      PE("No purkle to put - %s", buf);
   }
   else if (0 == strncmp(command, "llDialog(", 9))
   {
@@ -69,7 +68,6 @@ static Eina_Bool clientParser(void *data, Connection *connection, char *SID, cha
     }
     else
       PE("No LSLGuiMess to send - %s", command);
-
   }
   else if (0 == strncmp(command, "loadSim(", 8))
   {
@@ -556,7 +554,7 @@ static Eina_Bool _makeLove(void *data)
   ecore_job_add((Ecore_Cb) _makeFiles, ourGlobals);
 //  ecore_timer_add(0.1, _makeFiles, ourGlobals);
 
-  PD("About to try connecting to a love server.");
+//  PD("About to try connecting to a love server.");
   reachOut("love", "./love", "127.0.0.1", 8211 + 1, ourGlobals, (Ecore_Event_Handler_Cb) _add, /*(Ecore_Event_Handler_Cb) _data*/ NULL, (Ecore_Event_Handler_Cb) _del, clientParser);
 
   return ECORE_CALLBACK_CANCEL;
diff --git a/src/extantz/gears.c b/src/extantz/gears.c
index 68f817e..9998357 100644
--- a/src/extantz/gears.c
+++ b/src/extantz/gears.c
@@ -279,8 +279,7 @@ static GLuint load_shader(GLData *gld, GLenum type, const char *shader_src)
              if (info)
                {
                   gl->glGetShaderInfoLog(shader, len, NULL, info);
-                  printf("Error compiling shader:\n"
-                         "%s\n", info);
+                  PE("Error compiling shader: %s", info);
                   free(info);
                }
           }
@@ -332,7 +331,7 @@ void gears_init(GLData *gld)
 	    if (info)
 	    {
 		gld->glApi->glGetProgramInfoLog(gld->program, len, NULL, info);
-		printf("Error linking program:\n%s\n", info);
+		PE("Error linking program: %s", info);
 		free(info);
 	    }
 	}
diff --git a/src/libraries/LumbrJack.c b/src/libraries/LumbrJack.c
index 8683357..3bb67e9 100644
--- a/src/libraries/LumbrJack.c
+++ b/src/libraries/LumbrJack.c
@@ -19,7 +19,7 @@ int HamrTime(char *argv0, void *main, int logDom)
 
   if (!eina_init())
   {
-    printf("Can't load eina library, nothing else will work!\n");
+    fprintf(stderr, "Can't load eina library, nothing else will work!\n");
     exit(0);
   }
 
diff --git a/src/libraries/Runnr.c b/src/libraries/Runnr.c
index 5ec5a9c..04547b4 100644
--- a/src/libraries/Runnr.c
+++ b/src/libraries/Runnr.c
@@ -60,12 +60,12 @@ static int traceBack(lua_State *L)
   lua_Debug ar;
   int i, top = lua_gettop(L), b = 1;
 
-//  printf("Stack is %d deep\n", top);
+//  PI("Stack is %d deep", top);
 //  for (i = 1; i <= top; i++)
 //    dumpStack(L, i);
 
   if (top)
-    printf("Lua error - %s\n", lua_tostring(L, 1));
+    PE("Lua error - %s", lua_tostring(L, 1));
 
   i = 0;
   while (lua_getstack(L, i++, &ar))
@@ -74,15 +74,15 @@ static int traceBack(lua_State *L)
     {
       if (NULL == ar.name)
 	ar.name = "DUNNO";
-      printf("  Lua backtrace %d - %s %s %s @ %s : %d\n", i, ar.what, ar.namewhat, ar.name, ar.short_src, ar.currentline);
+      PE("  Lua backtrace %d - %s %s %s @ %s : %d", i, ar.what, ar.namewhat, ar.name, ar.short_src, ar.currentline);
       b = 0;
     }
     else
-      printf("  Failed to get trace line!\n");
+      PE("  Failed to get trace line!");
   }
 
   if (b)
-    printf("  NO BACKTRACE!\n");
+    PE("  NO BACKTRACE!");
 
   return 0;
 }
@@ -99,7 +99,7 @@ static void printLuaError(int err, char *string, lua_State *L)
     case LUA_ERRERR:	err_type = "error handler";	break;
     default:		err_type = "unknown";		break;
   }
-  printf("Error running - %s, \n  %s - %s\n", string, err_type, lua_tostring(L, -1));
+  PW("Error running - %s, \n  %s - %s", string, err_type, lua_tostring(L, -1));
 }
 
 static int panics = 0;
@@ -109,9 +109,9 @@ static int _panic(lua_State *L)                   // Stack usage [-0, +0, m]
   // of memory in the following lua_tostring() call.
   panics++;
   if (panics)
-    printf("Lua PANICS!!!!!");
+    PE("Lua PANICS!!!!!");
   else
-    printf("Lua PANIC!!!!!: %s", lua_tostring(L, -1));  // Stack usage [-0, +0, m]
+    PE("Lua PANIC!!!!!: %s", lua_tostring(L, -1));  // Stack usage [-0, +0, m]
   // The docs say that this will cause an exit(EXIT_FAILURE) if we return,
   // and that we we should long jump some where to avoid that.  This is only
   // called for things not called from a protected environment.  We always
@@ -147,7 +147,7 @@ void doLuaString(lua_State *L, char *string, char *module)
   {
     const char *err = lua_tostring(L, 1);
 
-    printf("Error parsing - %s, ERROR %s", string, err);
+    PE("Error parsing - %s, ERROR %s", string, err);
   }
   else
   {
@@ -159,12 +159,12 @@ void doLuaString(lua_State *L, char *string, char *module)
       // Consistancy would be good, just sayin'.
       if (0 == lua_setfenv(L, _A))
       {
-        printf("Error setting environment for - %s", string);
+        PE("Error setting environment for - %s", string);
         return;
       }
     }
 
-//printf("doLuaString(%s)\n", string);
+//PD("doLuaString(%s)\", string);
     if ((err = lua_pcall(L, 0, LUA_MULTRET, _T)))
       printLuaError(err, string, L);
   }
@@ -174,7 +174,7 @@ static void _stopScript(script *s)
 {
   scriptMessage *sm0, *sm1;
 
-//printf("^^^^^^^^^^^^^^^^^^^_stop(, %s)\n", s->name);
+//PD("^^^^^^^^^^^^^^^^^^^_stop(, %s)", s->name);
   if (s->L)		lua_close(s->L);	s->L = NULL;
   if (s->timer)	ecore_timer_del(s->timer);	s->timer = NULL;
   EINA_CLIST_FOR_EACH_ENTRY_SAFE(sm0, sm1, &(s->messages), scriptMessage, node)
@@ -210,7 +210,7 @@ static void _workerFunction(void *data, Ecore_Thread *thread)
 
   if (RUNNR_READY == s->status)
   {
-//printf("_workerFunction()  READY %s\n", s->name);
+//PD("_workerFunction()  READY %s", s->name);
     if ((msg = (scriptMessage *) eina_clist_head(&(s->messages))))
     {
       eina_clist_remove(&(msg->node));
@@ -226,7 +226,7 @@ static void _workerFunction(void *data, Ecore_Thread *thread)
   {
     int err;
 
-//printf("_workerFunction()  STARTING %s\n", s->name);
+//PD("_workerFunction()  STARTING %s", s->name);
     s->status = RUNNR_RUNNING;
     s->L = luaL_newstate();	// Sets a standard allocator and panic function.
 
@@ -243,7 +243,7 @@ static void _workerFunction(void *data, Ecore_Thread *thread)
     if (err != 0)
     {
       s->status = RUNNR_FINISHED;
-      printf("Error loading compiled Lua %s.", s->binName);
+      PE("Error loading compiled Lua %s.", s->binName);
     }
     gettimeofday(&s->startTime, NULL);
   }
@@ -254,7 +254,7 @@ static void _workerFunction(void *data, Ecore_Thread *thread)
   {
     int stat;
 
-//printf("_workerFunction()  RUNNING %s %s\n", s->name, message);
+//PD("_workerFunction()  RUNNING %s %s", s->name, message);
     // Resume running the script.
     // lua_resume() needs a Lua thread, and the initial Lua state is a thread.
     // Other Lua threads have their own state, but share the environment with the initial state.
@@ -270,7 +270,7 @@ static void _workerFunction(void *data, Ecore_Thread *thread)
       s->status = RUNNR_FINISHED;
     else if (stat != LUA_YIELD)
     {
-      printf("lua_resume error at %s\n", s->name);
+      PE("lua_resume error at %s", s->name);
       printLuaError(stat, s->name, s->L);
       s->status = RUNNR_FINISHED;
     }
@@ -288,7 +288,7 @@ static void _workerFunction(void *data, Ecore_Thread *thread)
   // Start again from the top when Ecore_Thread has a spare thread ready, unless the script finished.
   if (RUNNR_FINISHED == s->status)
   {
-//printf("_workerFunction()  FINISHED %s\n", s->name);
+//PD("_workerFunction()  FINISHED %s", s->name);
 #if THREADIT
     ecore_thread_cancel(thread);
 #else
@@ -297,7 +297,7 @@ static void _workerFunction(void *data, Ecore_Thread *thread)
   }
   else if (RUNNR_WAIT == s->status)
   {
-;//printf("_workerFunction()  WAIT    %s\n", s->name);
+;//PD("_workerFunction()  WAIT    %s", s->name);
   }
 #if THREADIT
   else if (RUNNR_READY == s->status)
@@ -323,7 +323,7 @@ static void _cancel(void *data, Ecore_Thread *thread)
   s->status = RUNNR_FINISHED;
   eina_clist_remove(&(s->node));
   if (s->SID[0])	ecore_thread_global_data_del(s->SID);	s->SID[0] = 0;
-//printf("^^^^^^^^^^^^^^^^^^^_del(, %s)\n", s->name);
+//PD("^^^^^^^^^^^^^^^^^^^_del(, %s)", s->name);
   // TODO - Perhaps have our own deletion callback to pass back?
   releaseScript(s);
 #if THREADIT
@@ -444,11 +444,11 @@ static void _compileThread(void *data, Ecore_Thread *thread)
         compiler->bugCount++;
 #if COMPILE_OUTPUT
 	if (LUA_ERRSYNTAX == err)
-	  printf("Lua syntax error in %s: %s\n", name, lua_tostring(L, -1));
+	  PI("Lua syntax error in %s: %s", name, lua_tostring(L, -1));
 	else if (LUA_ERRFILE == err)
-	  printf("Lua compile file error in %s: %s\n", name, lua_tostring(L, -1));
+	  PE("Lua compile file error in %s: %s", name, lua_tostring(L, -1));
 	else if (LUA_ERRMEM == err)
-	  printf("Lua compile memory allocation error in %s: %s\n", name, lua_tostring(L, -1));
+	  PC("Lua compile memory allocation error in %s: %s", name, lua_tostring(L, -1));
 #endif
       }
       else
@@ -462,28 +462,28 @@ static void _compileThread(void *data, Ecore_Thread *thread)
 	  if (err)
 	  {
 	    compiler->bugCount++;
-	    printf("Lua compile file error writing to %s\n", name);
+	    PE("Lua compile file error writing to %s", name);
 	  }
 	  fclose(out);
 	}
 	else
 	{
 	  compiler->bugCount++;
-	  printf("CRITICAL! Unable to open file %s for writing!\n", name);
+	  PE("CRITICAL! Unable to open file %s for writing!", name);
         }
       }
     }
     else if (!compiler->doConstants)
     {
       compiler->bugCount++;
-      printf("Can't create a new Lua state!\n");
+      PC("Can't create a new Lua state!");
     }
   }
   else
   {
     compiler->bugCount++;
 #if COMPILE_OUTPUT
-    printf("Nothing for Lua to compile!\n");
+    PW("Nothing for Lua to compile!");
 #endif
   }
 }
@@ -544,8 +544,8 @@ void takeScript(script *s)
 {
 #if THREADIT
   Eina_Lock_Result result = eina_lock_take(&s->mutex);
-  if (EINA_LOCK_DEADLOCK == result)  printf("Script %s IS DEADLOCKED!\n", s->name);
-  if (EINA_LOCK_FAIL     == result)  printf("Script %s LOCK FAILED!\n",   s->name);
+  if (EINA_LOCK_DEADLOCK == result)  PE("Script %s IS DEADLOCKED!", s->name);
+  if (EINA_LOCK_FAIL     == result)  PE("Script %s LOCK FAILED!",   s->name);
 #endif
 }
 
@@ -861,7 +861,7 @@ int push_lua(lua_State *L, char *params, ...)       // Stack usage [-0, +n, em]
       {
         if (table)  q = _push_name(L, q, &i);   // Stack usage [-0, +1, m]
         char *t = va_arg(vl, char *);
-//printf("push_lua %s string %s\n", p, t);
+//PD("push_lua %s string %s", p, t);
         lua_pushstring(L, t);  // Stack usage [-0, +1, m]
         break;
       }
diff --git a/src/libraries/SledjHamr.c b/src/libraries/SledjHamr.c
index 10eeca5..2fb9019 100644
--- a/src/libraries/SledjHamr.c
+++ b/src/libraries/SledjHamr.c
@@ -38,7 +38,7 @@ static boolean checkConnection(Connection *conn, char *func, connType wanted, bo
   if ((conn->type != CT_CLIENT) && (conn->type != CT_SERVER))
   {
     result = FALSE;
-    printf("CONNECTION OBJECT in %s() is of unknown type %d\n", func, (int) conn->type);
+    PE("CONNECTION OBJECT in %s() is of unknown type %d", func, (int) conn->type);
   }
   else if (conn->type != wanted)
   {
@@ -47,43 +47,43 @@ static boolean checkConnection(Connection *conn, char *func, connType wanted, bo
     {
       case CT_CLIENT :
 	if (conn->type == CT_SERVER)
-          printf("INVALID CONNECTION OBJECT in %s(), it might be a server object!\n", func);
+          PE("INVALID CONNECTION OBJECT in %s(), it might be a server object!", func);
 	else
-          printf("INVALID CONNECTION OBJECT in %s(), type is %d!\n", func, (int) conn->type);
+          PE("INVALID CONNECTION OBJECT in %s(), type is %d!", func, (int) conn->type);
 	if (conn->conn.client.myServer == NULL)
-	  printf("CONNECTION OBJECT in %s() is a local client, but should be a remote client mirror!\n", func);
+	  PE("CONNECTION OBJECT in %s() is a local client, but should be a remote client mirror!", func);
         break;
 
       case CT_SERVER :
 	if (conn->type == CT_CLIENT)
-	  printf("INVALID CONNECTION OBJECT in %s(), it might be a client object!\n", func);
+	  PE("INVALID CONNECTION OBJECT in %s(), it might be a client object!", func);
 	else
-	  printf("INVALID CONNECTION OBJECT in %s(), type is %d!\n", func, (int) conn->type);
+	  PE("INVALID CONNECTION OBJECT in %s(), type is %d!", func, (int) conn->type);
 	if (isLocal)
 	{
 	  if (conn->conn.server.clients == NULL)
-	    printf("CONNECTION OBJECT in %s() is a remote server mirror, but should be a local server!\n", func);
+	    PE("CONNECTION OBJECT in %s() is a remote server mirror, but should be a local server!", func);
 	}
 	else
 	{
 	  if (conn->conn.server.clients != NULL)
-	    printf("CONNECTION OBJECT in %s() is a local server, but should be a remote server mirror!\n", func);
+	    PE("CONNECTION OBJECT in %s() is a local server, but should be a remote server mirror!", func);
 	}
         break;
 
       default :
-	printf("CONNECTION OBJECT in %s(), silly coder asked for an unknown type!""\n", func);
+	PE("CONNECTION OBJECT in %s(), silly coder asked for an unknown type!", func);
 	break;
     }
 
     if (NULL == conn->name)
     {
       result = FALSE;
-      printf("CONNECTION OBJECT in %s() has no name!\n", func);
+      PE("CONNECTION OBJECT in %s() has no name!", func);
     }
   }
 
-//if (result)  printf("%s(\"%s\")\n", func, conn->name);
+//if (result)  PD("%s(\"%s\")", func, conn->name);
 
   return result;
 }
@@ -102,11 +102,11 @@ void sendBack(Connection *conn, const char *SID, const char *message, ...)
     va_end(args);
     buf[length++] = '\n';
     buf[length] = '\0';
-//    printf("sendBack(%s", buf);
+//    PD("sendBack(%s", buf);
 //    ecore_con_client_send(client, buf, length);
 //    ecore_con_client_flush(client);
 //Connection *conn = ecore_con_client_data_get(client);
-if (conn)  send2(conn, SID, buf);  else  printf("sendBack() can't find Connection!\n");
+if (conn)  send2(conn, SID, buf);  else  PE("sendBack() can't find Connection!");
 }
 
 void sendForth(Connection *conn, const char *SID, const char *message, ...)
@@ -123,11 +123,11 @@ void sendForth(Connection *conn, const char *SID, const char *message, ...)
     va_end(args);
     buf[length++] = '\n';
     buf[length] = '\0';
-//    printf("sendForth(%s", buf);
+//    PD("sendForth(%s", buf);
 //    ecore_con_server_send(server, buf, length);
 //    ecore_con_server_flush(server);
 //Connection *conn = ecore_con_server_data_get(server);
-if (conn)  send2(conn, SID, buf);  else  printf("sendForth() can't find Connection!\n");
+if (conn)  send2(conn, SID, buf);  else  PE("sendForth() can't find Connection!");
 }
 
 void send2(Connection *conn, const char *SID, const char *message, ...)
@@ -153,24 +153,24 @@ length = strlen(buf);
 	switch (conn->type)
 	{
 	    case CT_CLIENT :
-//		printf("vvv send2(%*s", length, buf);
+//		PD("vvv send2(%*s", length, buf);
 		ecore_con_client_send(conn->conn.client.client, strndup(buf, length), length);
 		ecore_con_client_flush(conn->conn.client.client);
 		break;
 
 	    case CT_SERVER :
-//		printf("^^^ send2(%*s", length, buf);
+//		PD("^^^ send2(%*s", length, buf);
 		ecore_con_server_send(conn->conn.server.server, strndup(buf, length), length);
 		ecore_con_server_flush(conn->conn.server.server);
 		break;
 
 	    default :
-		printf("send2() unable to send to partially bogus Connection object!\n");
+		PE("send2() unable to send to partially bogus Connection object!");
 		break;
 	}
     }
     else
-      printf("send2() unable to send to bogus Connection object!\n");
+      PE("send2() unable to send to bogus Connection object!");
 }
 
 static Eina_Bool parseStream(void *data, int type, void *evData, int evSize, void *ev)
@@ -180,7 +180,6 @@ static Eina_Bool parseStream(void *data, int type, void *evData, int evSize, voi
     const char *command;
     char *ext;
 
-//printf("parseStream(%s, \"%*s\")\n", conn->name, evSize, (char *) evData);
     if (NULL == conn->stream)
       conn->stream = eina_strbuf_new();
 
@@ -202,7 +201,6 @@ static Eina_Bool parseStream(void *data, int type, void *evData, int evSize, voi
 	    if (ext)
 	    {
 		streamParser func = eina_hash_find(conn->commands, command);
-//printf("parseStream(%s>> %s\"\n", conn->name, command);
 
 //		ext[0] = '\0';
 		// Need a callback if we can't find the command.
@@ -211,7 +209,7 @@ static Eina_Bool parseStream(void *data, int type, void *evData, int evSize, voi
 		if (func)
 		    func(conn->pointer, conn, SID, (char *) command, ext + 1);
 		else
-		    printf("parseStream() No function found for command %s!\n", command);
+		    PE("parseStream() No function found for command %s!", command);
             }
 	}
 
@@ -297,9 +295,9 @@ static Eina_Bool clientDel(void *data, int type, Ecore_Con_Event_Client_Del *ev)
 	// The "- 1" is coz this server is still counted.
 	clients = ecore_con_server_clients_get(conn->conn.server.server) - 1;
         if (0 == eina_list_count(clients))
-	    printf("No more clients for %s, exiting.\n", conn->name);
+	    PI("No more clients for %s, exiting.", conn->name);
 	else
-	    printf("Some (%d) more clients for %s, exiting anyway.\n", eina_list_count(clients), conn->name);
+	    PW("Some (%d) more clients for %s, exiting anyway.", eina_list_count(clients), conn->name);
 
 	// TODO - the Connection free function should take care of all of this, and we should call it here.  ish.
 	eina_clist_remove(conn->conn.client.server);
@@ -345,7 +343,7 @@ Connection *openArms(char *name, const char *address, int port, void *data, Ecor
       ecore_con_server_client_limit_set(server, -1, 0);
 //      ecore_con_server_timeout_set(server, 10);
 //      ecore_con_server_client_limit_set(server, 3, 0);
-        printf("ACTUALLY created the %s server %s:%d.\n", name, address, port);
+        PI("ACTUALLY created the %s server %s:%d.", name, address, port);
     }
     else
     {
@@ -368,9 +366,9 @@ static Eina_Bool serverAdd(void *data, int type, Ecore_Con_Event_Server_Add *ev)
     conn->stage++;
 
     if (conn->name)
-      printf("serverAdd()^^^^^^^^^^^^^^^^^^^^^^^Connected to %s server.\n", conn->name);
+      PI("serverAdd()^^^^^^^^^^^^^^^^^^^^^^^Connected to %s server.", conn->name);
     else
-      printf("serverAdd()^^^^^^^^^^^^^^^^^^^^^^^Connected to UNKNOWN server.\n");
+      PW("serverAdd()^^^^^^^^^^^^^^^^^^^^^^^Connected to UNKNOWN server.");
 
     // In case the server crashed, clear out any waiting data.
     if (conn->stream)
@@ -421,18 +419,16 @@ static Eina_Bool _reachOutTimer(void *data)
   {
     // TODO - Seems Ecore_con now has trouble with my try first, then start method, so start first, then try.  Fix this, or do something else.
     case -3 :
-      printf("Failed to connect to a %s server, starting our own.\n", conn->name);
+      PW("Failed to connect to a %s server, starting our own.", conn->name);
       conn->conn.server.serverHandle = ecore_exe_pipe_run(conn->conn.server.serverCommand, ECORE_EXE_NONE /*| ECORE_EXE_TERM_WITH_PARENT*/, conn);
       if (conn->conn.server.serverHandle)
       {
         conn->conn.server.pid = ecore_exe_pid_get(conn->conn.server.serverHandle);
         if (conn->conn.server.pid == -1)
-          fprintf(stderr, "Could not retrive the PID!\n");
-        else
-          fprintf(stdout, "The child process has PID:%u\n", (unsigned int)conn->conn.server.pid);
+          PE("Could not retrive the PID!");
       }
       else
-        fprintf(stderr, "Could not create server process %s!\n", conn->conn.server.serverCommand);
+        PE("Could not create server process %s!", conn->conn.server.serverCommand);
 
       // TODO - There's also the question of what to do if the connection failed.
       //        Did the server crash, or was it just the connection?
@@ -448,20 +444,20 @@ static Eina_Bool _reachOutTimer(void *data)
     case -1 :  // Give the server some time to start up.
       // Check if the server is still running here, if not, reset stage to previous -3 (taking into account the increment at the end).
       if (conn->conn.server.pid)
-        printf("Waiting for %s server to start from command \"%s\"\n", conn->name, conn->conn.server.serverCommand);
+        PI("Waiting for %s server to start from command \"%s\"", conn->name, conn->conn.server.serverCommand);
       else
         conn->stage = -4;
       break;
 
     case 0 :
-      printf("Attempting to connect to the %s server %s:%d.\n", conn->name, conn->address, conn->port);
+      PI("Attempting to connect to the %s server %s:%d.", conn->name, conn->address, conn->port);
       // This should only return NULL if something goes wrong with the setup, 
       // you wont know if the connection worked until you get the add callback,
       // or you get the del calback if it failed.
       if ((server = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, conn->address, conn->port, conn)))
-        printf("MAYBE connecting to the %s server %s:%d.\n", conn->name, conn->address, conn->port);
+        PD("MAYBE connecting to the %s server %s:%d.", conn->name, conn->address, conn->port);
       else
-        printf("FAILED to create the connection to the %s server %s:%d!\n", conn->name, conn->address, conn->port);
+        PE("FAILED to create the connection to the %s server %s:%d!", conn->name, conn->address, conn->port);
       conn->conn.server.server = server;
       break;
 
diff --git a/src/love/love.c b/src/love/love.c
index d8972d1..05f07db 100644
--- a/src/love/love.c
+++ b/src/love/love.c
@@ -197,7 +197,7 @@ static Eina_Bool LuaSLParser(void *data, Connection *conn, char *SID, char *comm
     char buf[PATH_MAX];
     LoveScript *me;
 
-PW("COMMAND - %s - %s", SID, command);
+PD("COMMAND - %s - %s", SID, command);
     me = eina_hash_find(ourGlobals->scripts, SID);
     if (0 == strncmp(command, "compilerWarning(", 16))
     {
@@ -260,7 +260,7 @@ PW("COMMAND - %s - %s", SID, command);
 	    if (compiledCount == scriptCount)
 	    {
 		float total = timeDiff(&now, &startTime);
-		PD("Compile speed scripts: %d time: %fs total: %f scripts per second", compiledCount, total, compiledCount / total);
+		PI("Compile speed scripts: %d time: %fs total: %f scripts per second", compiledCount, total, compiledCount / total);
 	    }
 	}
     }
@@ -274,10 +274,10 @@ PW("COMMAND - %s - %s", SID, command);
 	    if (compiledCount == scriptCount)
 	    {
 		float total = timeDiff(&now, &startTime);
-		PD("Compile speed scripts: %d time: %fs total: %f scripts per second", compiledCount, total, compiledCount / total);
+		PI("Compile speed scripts: %d time: %fs total: %f scripts per second", compiledCount, total, compiledCount / total);
 	    }
 	}
-	PD("About to run %s", me->fileName);
+//PD("About to run %s", me->fileName);
 	sendForth(ourGlobals->serverLuaSL, SID, "run(%s)", me->fileName);
     }
     else
@@ -676,11 +676,11 @@ int main(int argc, char **argv)
 				edje_object_signal_callback_add(ourGlobals.edje, "*", "game_*", _edje_signal_cb, &ourGlobals);
 			    }
 
-			    PD("About to try connecting to a LuaSL server.");
+//			    PD("About to try connecting to a LuaSL server.");
 			    // Try to connect to a local LuaSL server.
 			    reachOut("LuaSL", "./LuaSL", "127.0.0.1", ourGlobals.port, &ourGlobals, (Ecore_Event_Handler_Cb) _addLuaSL, /*(Ecore_Event_Handler_Cb) _dataLuaSL*/ NULL, (Ecore_Event_Handler_Cb) _delLuaSL, LuaSLParser);
 
-			    PD("Love is about to try creating a love server.");
+//			    PD("Love is about to try creating a love server.");
 			    if (openArms("love", ourGlobals.address, ourGlobals.port + 1, &ourGlobals, (Ecore_Event_Handler_Cb) _addClient, NULL, (Ecore_Event_Handler_Cb) _delClient, clientParser))
 			    {
 				ecore_main_loop_begin();
-- 
cgit v1.1