Author: cazfi
Date: Sat Mar 14 06:51:34 2015
New Revision: 28521

URL: http://svn.gna.org/viewcvs/freeciv?rev=28521&view=rev
Log:
Added log_packet_json() that logs all the json sent or received over json 
protocol

See patch #5914

Modified:
    trunk/common/packets_json.c
    trunk/common/packets_json.h

Modified: trunk/common/packets_json.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/packets_json.c?rev=28521&r1=28520&r2=28521&view=diff
==============================================================================
--- trunk/common/packets_json.c (original)
+++ trunk/common/packets_json.c Sat Mar 14 06:51:34 2015
@@ -332,6 +332,8 @@
     log_error("%s", error.text);
   }
 
+  log_packet_json("Json in: %s", pc->buffer->data + 2);
+
   /* Shift remaining data to the front */
   pc->buffer->ndata -= whole_packet_len;
   memmove(pc->buffer->data, pc->buffer->data + whole_packet_len, 
pc->buffer->ndata);

Modified: trunk/common/packets_json.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/packets_json.h?rev=28521&r1=28520&r2=28521&view=diff
==============================================================================
--- trunk/common/packets_json.h (original)
+++ trunk/common/packets_json.h Sat Mar 14 06:51:34 2015
@@ -19,6 +19,8 @@
 
 #include <jansson.h>
 
+#define log_packet_json log_debug
+
 void *get_packet_from_connection_json(struct connection *pc,
                                       enum packet_type *ptype);
 
@@ -36,7 +38,8 @@
   { \
     json_buffer = json_dumps(dout.json, JSON_COMPACT | JSON_ENSURE_ASCII); \
     if (json_buffer) { \
-      dio_put_string_raw(&(dout.raw), json_buffer);     \
+      dio_put_string_raw(&(dout.raw), json_buffer); \
+      log_packet_json("Json out: %s", json_buffer); \
     } \
     size_t size = dio_output_used(&(dout.raw)); \
     \


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to