diff options
author | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2015-08-27 12:24:22 -0700 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2015-08-27 12:24:22 -0700 |
commit | 1c3b21330632a12e14f6d3130db99b03940075fc (patch) | |
tree | 60b7e6fcb140c2086d1ea4c5637570ce48e6dcf8 | |
parent | 9a97a096ceff70c4dda7b0a5fb4c8f4ca0afafd1 (diff) | |
parent | d17fcc320367cd2c16f0c25a5a58dbf2ddbba412 (diff) |
Merge pull request #3070 from ctiller/winlog
Make C core log output readable
-rw-r--r-- | src/core/support/log_win32.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/core/support/log_win32.c b/src/core/support/log_win32.c index 629781da8a..b68239f8f5 100644 --- a/src/core/support/log_win32.c +++ b/src/core/support/log_win32.c @@ -81,10 +81,18 @@ void gpr_log(const char *file, int line, gpr_log_severity severity, /* Simple starter implementation */ void gpr_default_log(gpr_log_func_args *args) { + char *final_slash; + const char *display_file; char time_buffer[64]; gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME); struct tm tm; + final_slash = strrchr(args->file, '\\'); + if (final_slash == NULL) + display_file = args->file; + else + display_file = final_slash + 1; + if (localtime_s(&tm, &now.tv_sec)) { strcpy(time_buffer, "error:localtime"); } else if (0 == @@ -94,7 +102,7 @@ void gpr_default_log(gpr_log_func_args *args) { fprintf(stderr, "%s%s.%09u %5lu %s:%d] %s\n", gpr_log_severity_string(args->severity), time_buffer, - (int)(now.tv_nsec), GetCurrentThreadId(), args->file, args->line, + (int)(now.tv_nsec), GetCurrentThreadId(), display_file, args->line, args->message); } |