Tweaking log calls a bit.

-) Introducing gpr_vlog so to spare a few vsprintf later (at least one for now)
-) Renaming statistics/log.* to statistics/census_log.* to avoid collisions.
	Change on 2014/12/12 by nnoble <nnoble@google.com>
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81995756
diff --git a/Makefile b/Makefile
index 03de0aa..80a2e51 100644
--- a/Makefile
+++ b/Makefile
@@ -674,7 +674,7 @@
     src/core/statistics/census_rpc_stats.c \
     src/core/statistics/census_tracing.c \
     src/core/statistics/hash_table.c \
-    src/core/statistics/log.c \
+    src/core/statistics/census_log.c \
     src/core/statistics/window_stats.c \
     src/core/surface/byte_buffer.c \
     src/core/surface/byte_buffer_reader.c \
@@ -1592,7 +1592,7 @@
     src/core/statistics/census_rpc_stats.c \
     src/core/statistics/census_tracing.c \
     src/core/statistics/hash_table.c \
-    src/core/statistics/log.c \
+    src/core/statistics/census_log.c \
     src/core/statistics/window_stats.c \
     src/core/surface/byte_buffer.c \
     src/core/surface/byte_buffer_reader.c \
diff --git a/build.json b/build.json
index e615826..b4dc9b6 100644
--- a/build.json
+++ b/build.json
@@ -137,7 +137,7 @@
         "src/core/statistics/census_rpc_stats.c",
         "src/core/statistics/census_tracing.c",
         "src/core/statistics/hash_table.c",
-        "src/core/statistics/log.c",
+        "src/core/statistics/census_log.c",
         "src/core/statistics/window_stats.c",
         "src/core/surface/byte_buffer.c",
         "src/core/surface/byte_buffer_reader.c",
@@ -228,7 +228,7 @@
         "src/core/statistics/census_interface.h",
         "src/core/statistics/census_rpc_stats.h",
         "src/core/statistics/hash_table.h",
-        "src/core/statistics/log.h",
+        "src/core/statistics/census_log.h",
         "src/core/statistics/window_stats.h",
         "src/core/surface/call.h",
         "src/core/surface/channel.h",
diff --git a/include/grpc/support/log.h b/include/grpc/support/log.h
index b79d661..5d0b790 100644
--- a/include/grpc/support/log.h
+++ b/include/grpc/support/log.h
@@ -35,6 +35,7 @@
 #define __GRPC_SUPPORT_LOG_H__
 
 #include <stdlib.h> /* for abort() */
+#include <stdarg.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -71,6 +72,10 @@
 void gpr_log(const char *file, int line, gpr_log_severity severity,
              const char *format, ...);
 
+/* Same as above, but using a va_list instead. */
+void gpr_vlog(const char *file, int line, gpr_log_severity severity,
+              const char *format, va_list args);
+
 /* abort() the process if x is zero, having written a line to the log.
 
    Intended for internal invariants.  If the error can be recovered from,
diff --git a/src/core/channel/connected_channel.c b/src/core/channel/connected_channel.c
index 5dc4d7a..8581fb4 100644
--- a/src/core/channel/connected_channel.c
+++ b/src/core/channel/connected_channel.c
@@ -289,15 +289,12 @@
 
 static void recv_error(channel_data *chand, call_data *calld, int line,
                        const char *fmt, ...) {
-  char msg[512];
   va_list a;
 
   va_start(a, fmt);
-  vsprintf(msg, fmt, a);
+  gpr_vlog(__FILE__, line, GPR_LOG_SEVERITY_ERROR, fmt, a);
   va_end(a);
 
-  gpr_log(__FILE__, line, GPR_LOG_SEVERITY_ERROR, "%s", msg);
-
   if (chand->transport) {
     grpc_transport_abort_stream(chand->transport,
                                 TRANSPORT_STREAM_FROM_CALL_DATA(calld),
diff --git a/src/core/statistics/log.c b/src/core/statistics/census_log.c
similarity index 99%
rename from src/core/statistics/log.c
rename to src/core/statistics/census_log.c
index 43a8653..9de9d2e 100644
--- a/src/core/statistics/log.c
+++ b/src/core/statistics/census_log.c
@@ -89,7 +89,7 @@
    include the name of the structure, which will be passed as the first
    argument. E.g. cl_block_initialize() will initialize a cl_block.
 */
-#include "src/core/statistics/log.h"
+#include "src/core/statistics/census_log.h"
 #include <string.h>
 #include "src/core/support/cpu.h"
 #include <grpc/support/alloc.h>
diff --git a/src/core/statistics/log.h b/src/core/statistics/census_log.h
similarity index 100%
rename from src/core/statistics/log.h
rename to src/core/statistics/census_log.h
diff --git a/src/core/support/log.c b/src/core/support/log.c
index 79321f7..b9e2897 100644
--- a/src/core/support/log.c
+++ b/src/core/support/log.c
@@ -46,3 +46,13 @@
   }
   return "UNKNOWN";
 }
+
+void gpr_log(const char *file, int line, gpr_log_severity severity,
+             const char *format, ...) {
+  va_list args;
+  va_start(args, format);
+
+  gpr_vlog(file, line, severity, format, args);
+
+  va_end(args);
+}
diff --git a/src/core/support/log_android.c b/src/core/support/log_android.c
index 9e2b034..4c83e09 100644
--- a/src/core/support/log_android.c
+++ b/src/core/support/log_android.c
@@ -54,15 +54,13 @@
   return ANDROID_LOG_DEFAULT;
 }
 
-void gpr_log(const char *file, int line, gpr_log_severity severity,
-             const char *format, ...) {
+void gpr_vlog(const char *file, int line, gpr_log_severity severity,
+              const char *format, va_list args) {
   char *final_slash;
   const char *display_file;
   char *prefix = NULL;
   char *suffix = NULL;
   char *output = NULL;
-  va_list args;
-  va_start(args, format);
 
   final_slash = strrchr(file, '/');
   if (final_slash == NULL)
@@ -73,7 +71,6 @@
   asprintf(&prefix, "%s:%d] ", display_file, line);
   vasprintf(&suffix, format, args);
   asprintf(&output, "%s%s", prefix, suffix);
-  va_end(args);
 
   __android_log_write(severity_to_log_priority(severity), "GRPC", output);
 
diff --git a/src/core/support/log_linux.c b/src/core/support/log_linux.c
index e39e2cc..322ff07 100644
--- a/src/core/support/log_linux.c
+++ b/src/core/support/log_linux.c
@@ -49,15 +49,13 @@
 
 static long gettid() { return syscall(__NR_gettid); }
 
-void gpr_log(const char *file, int line, gpr_log_severity severity,
-             const char *format, ...) {
+void gpr_vlog(const char *file, int line, gpr_log_severity severity,
+              const char *format, va_list args) {
   char *final_slash;
   const char *display_file;
   char time_buffer[64];
   gpr_timespec now = gpr_now();
   struct tm tm;
-  va_list args;
-  va_start(args, format);
 
   final_slash = strrchr(file, '/');
   if (final_slash == NULL)
@@ -78,8 +76,6 @@
   vfprintf(stderr, format, args);
   fputc('\n', stderr);
   funlockfile(stderr);
-
-  va_end(args);
 }
 
 #endif
diff --git a/src/core/support/log_posix.c b/src/core/support/log_posix.c
index 68882f7..b47c433 100644
--- a/src/core/support/log_posix.c
+++ b/src/core/support/log_posix.c
@@ -47,15 +47,13 @@
 
 static long gettid() { return pthread_self(); }
 
-void gpr_log(const char *file, int line, gpr_log_severity severity,
-             const char *format, ...) {
+void gpr_vlog(const char *file, int line, gpr_log_severity severity,
+              const char *format, va_list args) {
   char *final_slash;
   const char *display_file;
   char time_buffer[64];
   gpr_timespec now = gpr_now();
   struct tm tm;
-  va_list args;
-  va_start(args, format);
 
   final_slash = strrchr(file, '/');
   if (final_slash == NULL)
@@ -76,8 +74,6 @@
   vfprintf(stderr, format, args);
   fputc('\n', stderr);
   funlockfile(stderr);
-
-  va_end(args);
 }
 
 #endif /* defined(GPR_POSIX_LOG) */
diff --git a/src/core/support/log_win32.c b/src/core/support/log_win32.c
index fb2fc0c..e6567dc 100644
--- a/src/core/support/log_win32.c
+++ b/src/core/support/log_win32.c
@@ -40,16 +40,11 @@
 #include <stdarg.h>
 
 /* Simple starter implementation */
-void gpr_log(const char *file, int line, gpr_log_severity severity,
-             const char *format, ...) {
-  va_list args;
-  va_start(args, format);
-
+void gpr_vlog(const char *file, int line, gpr_log_severity severity,
+              const char *format, va_list args) {
   fprintf(stderr, "%s %s:%d: ", gpr_log_severity_string(severity), file, line);
   vfprintf(stderr, format, args);
   fputc('\n', stderr);
-
-  va_end(args);
 }
 
 #endif
diff --git a/test/core/statistics/log_tests.c b/test/core/statistics/census_log_tests.c
similarity index 99%
rename from test/core/statistics/log_tests.c
rename to test/core/statistics/census_log_tests.c
index f0cbdbd..179d1cd 100644
--- a/test/core/statistics/log_tests.c
+++ b/test/core/statistics/census_log_tests.c
@@ -31,7 +31,7 @@
  *
  */
 
-#include "src/core/statistics/log.h"
+#include "src/core/statistics/census_log.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/test/core/statistics/log_tests.h b/test/core/statistics/census_log_tests.h
similarity index 100%
rename from test/core/statistics/log_tests.h
rename to test/core/statistics/census_log_tests.h
diff --git a/test/core/statistics/multiple_writers_circular_buffer_test.c b/test/core/statistics/multiple_writers_circular_buffer_test.c
index 0cd0d78..298900a 100644
--- a/test/core/statistics/multiple_writers_circular_buffer_test.c
+++ b/test/core/statistics/multiple_writers_circular_buffer_test.c
@@ -31,7 +31,7 @@
  *
  */
 
-#include "test/core/statistics/log_tests.h"
+#include "test/core/statistics/census_log_tests.h"
 
 #include <stdlib.h>
 
diff --git a/test/core/statistics/multiple_writers_test.c b/test/core/statistics/multiple_writers_test.c
index b1f3be4..ae6fd95 100644
--- a/test/core/statistics/multiple_writers_test.c
+++ b/test/core/statistics/multiple_writers_test.c
@@ -31,7 +31,7 @@
  *
  */
 
-#include "test/core/statistics/log_tests.h"
+#include "test/core/statistics/census_log_tests.h"
 
 #include <stdlib.h>
 
diff --git a/test/core/statistics/performance_test.c b/test/core/statistics/performance_test.c
index 9197dd5..40fe4c5 100644
--- a/test/core/statistics/performance_test.c
+++ b/test/core/statistics/performance_test.c
@@ -31,7 +31,7 @@
  *
  */
 
-#include "log_tests.h"
+#include "test/core/statistics/census_log_tests.h"
 
 #include <stdlib.h>
 
diff --git a/test/core/statistics/quick_test.c b/test/core/statistics/quick_test.c
index fe2b89a..8df32cf 100644
--- a/test/core/statistics/quick_test.c
+++ b/test/core/statistics/quick_test.c
@@ -31,7 +31,7 @@
  *
  */
 
-#include "log_tests.h"
+#include "test/core/statistics/census_log_tests.h"
 
 #include <stdlib.h>
 
diff --git a/vsprojects/vs2013/grpc.vcxproj b/vsprojects/vs2013/grpc.vcxproj
index 4a0c2a1..c01322b 100644
--- a/vsprojects/vs2013/grpc.vcxproj
+++ b/vsprojects/vs2013/grpc.vcxproj
@@ -123,7 +123,7 @@
     <ClInclude Include="..\..\src\core\statistics\census_interface.h" />
     <ClInclude Include="..\..\src\core\statistics\census_rpc_stats.h" />
     <ClInclude Include="..\..\src\core\statistics\hash_table.h" />
-    <ClInclude Include="..\..\src\core\statistics\log.h" />
+    <ClInclude Include="..\..\src\core\statistics\census_log.h" />
     <ClInclude Include="..\..\src\core\statistics\window_stats.h" />
     <ClInclude Include="..\..\src\core\surface\call.h" />
     <ClInclude Include="..\..\src\core\surface\channel.h" />
@@ -246,7 +246,7 @@
     </ClCompile>
     <ClCompile Include="..\..\src\core\statistics\hash_table.c">
     </ClCompile>
-    <ClCompile Include="..\..\src\core\statistics\log.c">
+    <ClCompile Include="..\..\src\core\statistics\census_log.c">
     </ClCompile>
     <ClCompile Include="..\..\src\core\statistics\window_stats.c">
     </ClCompile>