From 75985ab75ed216cd8c873c9ef08cd88708f8354f Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 27 Jul 2011 12:33:22 -0700 Subject: [PATCH] Remove color-related code from rust_log This is all dead. If someone decides they want color it will be easy to redo. --- src/rt/rust_log.cpp | 33 ++------------------------------- src/rt/rust_log.h | 17 ----------------- 2 files changed, 2 insertions(+), 48 deletions(-) diff --git a/src/rt/rust_log.cpp b/src/rt/rust_log.cpp index a2ab77b1b55..c23a38bc1da 100644 --- a/src/rt/rust_log.cpp +++ b/src/rt/rust_log.cpp @@ -1,6 +1,5 @@ /* - * Logging infrastructure that aims to support multi-threading, - * and ansi colors. + * Logging infrastructure that aims to support multi-threading */ #include "rust_internal.h" @@ -9,13 +8,6 @@ #include #include -static const char * _foreground_colors[] = { "[37m", - "[31m", "[1;31m", - "[32m", "[1;32m", - "[33m", "[1;33m", - "[31m", "[1;31m", - "[35m", "[1;35m", - "[36m", "[1;36m" }; /** * Synchronizes access to the underlying logging mechanism. @@ -25,8 +17,7 @@ static uint32_t _last_thread_id; rust_log::rust_log(rust_srv *srv, rust_scheduler *sched) : _srv(srv), - _sched(sched), - _use_colors(getenv("RUST_COLOR_LOG")) { + _sched(sched) { } rust_log::~rust_log() { @@ -45,11 +36,6 @@ hash(uintptr_t ptr) { return (uint16_t) ptr; } -const char * -get_color(uintptr_t ptr) { - return _foreground_colors[hash(ptr) % rust_log::LIGHTTEAL]; -} - char * copy_string(char *dst, const char *src, size_t length) { return strncpy(dst, src, length) + length; @@ -67,21 +53,6 @@ append_string(char *buffer, const char *format, ...) { return buffer; } -char * -append_string(char *buffer, rust_log::ansi_color color, - const char *format, ...) { - if (buffer != NULL && format) { - append_string(buffer, "\x1b%s", _foreground_colors[color]); - va_list args; - va_start(args, format); - size_t off = strlen(buffer); - vsnprintf(buffer + off, BUF_BYTES - off, format, args); - va_end(args); - append_string(buffer, "\x1b[0m"); - } - return buffer; -} - void rust_log::trace_ln(uint32_t thread_id, char *prefix, char *message) { char buffer[BUF_BYTES] = ""; diff --git a/src/rt/rust_log.h b/src/rt/rust_log.h index d14cb022bfd..6021125705b 100644 --- a/src/rt/rust_log.h +++ b/src/rt/rust_log.h @@ -41,22 +41,6 @@ public: rust_log(rust_srv *srv, rust_scheduler *sched); virtual ~rust_log(); - enum ansi_color { - WHITE, - RED, - LIGHTRED, - GREEN, - LIGHTGREEN, - YELLOW, - LIGHTYELLOW, - BLUE, - LIGHTBLUE, - MAGENTA, - LIGHTMAGENTA, - TEAL, - LIGHTTEAL - }; - void trace_ln(rust_task *task, uint32_t level, char *message); void trace_ln(uint32_t thread_id, char *prefix, char *message); bool is_tracing(uint32_t type_bits); @@ -65,7 +49,6 @@ private: rust_srv *_srv; rust_scheduler *_sched; bool _use_labels; - bool _use_colors; void trace_ln(rust_task *task, char *message); };