Various fixes and utilties.

This commit is contained in:
Ben Vanik
2015-05-02 00:26:03 -07:00
parent 98e7e2727b
commit 727ffaa122
13 changed files with 74 additions and 15 deletions

View File

@@ -9,12 +9,14 @@
#include "poly/logging.h"
#include <gflags/gflags.h>
#include <mutex>
#include <gflags/gflags.h>
#include "poly/cxx_compat.h"
#include "poly/main.h"
#include "poly/math.h"
#include "poly/threading.h"
DEFINE_bool(fast_stdout, false,
"Don't lock around stdout/stderr. May introduce weirdness.");
@@ -42,14 +44,18 @@ void format_log_line(char* buffer, size_t buffer_count, const char* file_path,
}
// Format string - add a trailing newline if required.
const char* outfmt = "%c> %s:%d: ";
const char* outfmt = "%c> %.2X %s:%d: ";
buffer_ptr = buffer + snprintf(buffer, buffer_count - 1, outfmt, level_char,
poly::threading::current_thread_id(),
filename, line_number);
} else {
buffer_ptr = buffer;
*(buffer_ptr++) = level_char;
*(buffer_ptr++) = '>';
*(buffer_ptr++) = ' ';
buffer_ptr +=
sprintf(buffer_ptr, "%.4X", poly::threading::current_thread_id());
*(buffer_ptr++) = ' ';
}
// Scribble args into the print buffer.