Remove color-related code from rust_log

This is all dead. If someone decides they want color it will be easy to redo.
This commit is contained in:
Brian Anderson 2011-07-27 12:33:22 -07:00
parent 86f337484e
commit 75985ab75e
2 changed files with 2 additions and 48 deletions

View File

@ -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 <stdlib.h>
#include <string.h>
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] = "";

View File

@ -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);
};