Further corrections to the logging layer in runtime.

This commit is contained in:
Graydon Hoare 2011-01-14 16:01:43 -08:00
parent 5b9eda4a41
commit d55bee4417
4 changed files with 8 additions and 6 deletions

View File

@ -90,7 +90,7 @@ static intptr_t const CONST_REFCOUNT = 0x7badface;
// This accounts for logging buffers.
static size_t const BUF_BYTES = 1024;
static size_t const BUF_BYTES = 2048;
// Every reference counted object should derive from this base class.

View File

@ -119,7 +119,7 @@ rust_kernel::is_deadlocked() {
void
rust_kernel::log(uint32_t type_bits, char const *fmt, ...) {
char buf[256];
char buf[BUF_BYTES];
if (_log.is_tracing(type_bits)) {
va_list args;
va_start(args, fmt);

View File

@ -114,7 +114,8 @@ append_string(char *buffer, const char *format, ...) {
if (buffer != NULL && format) {
va_list args;
va_start(args, format);
vsprintf(buffer + strlen(buffer), format, args);
size_t off = strlen(buffer);
vsnprintf(buffer + off, BUF_BYTES - off, format, args);
va_end(args);
}
return buffer;
@ -127,7 +128,8 @@ append_string(char *buffer, rust_log::ansi_color color,
append_string(buffer, "\x1b%s", _foreground_colors[color]);
va_list args;
va_start(args, format);
vsprintf(buffer + strlen(buffer), format, args);
size_t off = strlen(buffer);
vsnprintf(buffer + off, BUF_BYTES - off, format, args);
va_end(args);
append_string(buffer, "\x1b[0m");
}
@ -193,7 +195,7 @@ rust_log::trace_ln(rust_task *task, ansi_color color,
uint32_t type_bits, char *message) {
if (is_tracing(type_bits)) {
if (_use_colors) {
char buffer[512] = "";
char buffer[BUF_BYTES] = "";
append_string(buffer, color, "%s", message);
trace_ln(task, buffer);
} else {

View File

@ -631,7 +631,7 @@ rust_task::get_crate_cache(rust_crate const *curr_crate)
void
rust_task::log(uint32_t type_bits, char const *fmt, ...) {
char buf[256];
char buf[BUF_BYTES];
if (dom->get_log().is_tracing(type_bits)) {
va_list args;
va_start(args, fmt);