]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/urllib.qc
Replace print calls with logger calls
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / urllib.qc
index ce8de504b028f8c1ff654b632e196f1b86633512..9648b2080f5abb0cae734a96d3a220dcd93ae5c2 100644 (file)
@@ -35,7 +35,7 @@ float url_URI_Get_Callback(int id, float status, string data)
                return 0;
        if(e.url_rbuf >= 0 || e.url_wbuf >= 0)
        {
-               printf("WARNING: handle %d (%s) has already received data?!?\n", id + NUM_URL_ID, e.url_url);
+               LOG_INFOF("WARNING: handle %d (%s) has already received data?!?\n", id + NUM_URL_ID, e.url_url);
                return 0;
        }
 
@@ -54,7 +54,7 @@ float url_URI_Get_Callback(int id, float status, string data)
                e.url_rbuf = buf_create();
                if(e.url_rbuf < 0)
                {
-                       print("url_URI_Get_Callback: out of memory in buf_create\n");
+                       LOG_INFO("url_URI_Get_Callback: out of memory in buf_create\n");
                        e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
                        strunzone(e.url_url);
                        remove(e);
@@ -63,7 +63,7 @@ float url_URI_Get_Callback(int id, float status, string data)
                e.url_rbufpos = 0;
                if(e.url_rbuf < 0)
                {
-                       print("url_URI_Get_Callback: out of memory in buf_create\n");
+                       LOG_INFO("url_URI_Get_Callback: out of memory in buf_create\n");
                        e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
                        strunzone(e.url_url);
                        remove(e);
@@ -105,7 +105,7 @@ void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
                                e.url_wbuf = buf_create();
                                if(e.url_wbuf < 0)
                                {
-                                       print("url_single_fopen: out of memory in buf_create\n");
+                                       LOG_INFO("url_single_fopen: out of memory in buf_create\n");
                                        rdy(e, pass, URL_READY_ERROR);
                                        strunzone(e.url_url);
                                        remove(e);
@@ -132,7 +132,7 @@ void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
                                                        break;
                                        if(i >= autocvar__urllib_nextslot)
                                        {
-                                               print("url_single_fopen: too many concurrent requests\n");
+                                               LOG_INFO("url_single_fopen: too many concurrent requests\n");
                                                rdy(NULL, pass, URL_READY_ERROR);
                                                return;
                                        }
@@ -141,7 +141,7 @@ void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
                                // GET the data
                                if(!crypto_uri_postbuf(url, i + MIN_URL_ID, string_null, string_null, -1, 0))
                                {
-                                       print("url_single_fopen: failure in crypto_uri_postbuf\n");
+                                       LOG_INFO("url_single_fopen: failure in crypto_uri_postbuf\n");
                                        rdy(NULL, pass, URL_READY_ERROR);
                                        return;
                                }
@@ -179,7 +179,7 @@ void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
                                rdy(e, pass, URL_READY_CANWRITE);
                                break;
                        case FILE_READ:
-                               print("url_single_fopen: cannot open '-' for reading\n");
+                               LOG_INFO("url_single_fopen: cannot open '-' for reading\n");
                                rdy(NULL, pass, URL_READY_ERROR);
                                break;
                }
@@ -235,7 +235,7 @@ void url_fclose(entity e)
                                                break;
                                if(i >= autocvar__urllib_nextslot)
                                {
-                                       print("url_fclose: too many concurrent requests\n");
+                                       LOG_INFO("url_fclose: too many concurrent requests\n");
                                        e.url_ready(e,e.url_ready_pass, URL_READY_ERROR);
                                        buf_del(e.url_wbuf);
                                        strunzone(e.url_url);
@@ -247,7 +247,7 @@ void url_fclose(entity e)
                        // POST the data
                        if(!crypto_uri_postbuf(e.url_url, i + MIN_URL_ID, "text/plain", "", e.url_wbuf, 0))
                        {
-                               print("url_fclose: failure in crypto_uri_postbuf\n");
+                               LOG_INFO("url_fclose: failure in crypto_uri_postbuf\n");
                                e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
                                buf_del(e.url_wbuf);
                                strunzone(e.url_url);
@@ -328,7 +328,7 @@ void url_fputs(entity e, string s)
        else if(e.url_fh == URL_FH_STDOUT)
        {
                // stdout
-               print(s);
+               LOG_INFO(s);
        }
        else
        {
@@ -345,7 +345,7 @@ void url_multi_ready(entity fh, entity me, float status)
        {
                if(status == -422) // Unprocessable Entity
                {
-                       print("uri_multi_ready: got HTTP error 422, data is in unusable format - not continuing\n");
+                       LOG_INFO("uri_multi_ready: got HTTP error 422, data is in unusable format - not continuing\n");
                        me.url_ready(fh, me.url_ready_pass, status);
                        strunzone(me.url_url);
                        remove(me);
@@ -371,7 +371,7 @@ void url_multi_fopen(string url, int mode, url_ready_func rdy, entity pass)
        n = tokenize_console(url);
        if(n <= 0)
        {
-               print("url_multi_fopen: need at least one URL\n");
+               LOG_INFO("url_multi_fopen: need at least one URL\n");
                rdy(NULL, pass, URL_READY_ERROR);
                return;
        }