1
1
/*
2
- * Logging infrastructure that aims to support multi-threading,
3
- * and ansi colors.
2
+ * Logging infrastructure that aims to support multi-threading
4
3
*/
5
4
6
5
#include " rust_internal.h"
9
8
#include < stdlib.h>
10
9
#include < string.h>
11
10
12
- static const char * _foreground_colors[] = { " [37m" ,
13
- " [31m" , " [1;31m" ,
14
- " [32m" , " [1;32m" ,
15
- " [33m" , " [1;33m" ,
16
- " [31m" , " [1;31m" ,
17
- " [35m" , " [1;35m" ,
18
- " [36m" , " [1;36m" };
19
11
20
12
/* *
21
13
* Synchronizes access to the underlying logging mechanism.
@@ -25,8 +17,7 @@ static uint32_t _last_thread_id;
25
17
26
18
rust_log::rust_log (rust_srv *srv, rust_scheduler *sched) :
27
19
_srv(srv),
28
- _sched(sched),
29
- _use_colors(getenv(" RUST_COLOR_LOG" )) {
20
+ _sched(sched) {
30
21
}
31
22
32
23
rust_log::~rust_log () {
@@ -45,11 +36,6 @@ hash(uintptr_t ptr) {
45
36
return (uint16_t ) ptr;
46
37
}
47
38
48
- const char *
49
- get_color (uintptr_t ptr) {
50
- return _foreground_colors[hash (ptr) % rust_log::LIGHTTEAL];
51
- }
52
-
53
39
char *
54
40
copy_string (char *dst, const char *src, size_t length) {
55
41
return strncpy (dst, src, length) + length;
@@ -67,21 +53,6 @@ append_string(char *buffer, const char *format, ...) {
67
53
return buffer;
68
54
}
69
55
70
- char *
71
- append_string (char *buffer, rust_log::ansi_color color,
72
- const char *format, ...) {
73
- if (buffer != NULL && format) {
74
- append_string (buffer, " \x1b %s" , _foreground_colors[color]);
75
- va_list args;
76
- va_start (args, format);
77
- size_t off = strlen (buffer);
78
- vsnprintf (buffer + off, BUF_BYTES - off, format, args);
79
- va_end (args);
80
- append_string (buffer, " \x1b [0m" );
81
- }
82
- return buffer;
83
- }
84
-
85
56
void
86
57
rust_log::trace_ln (uint32_t thread_id, char *prefix, char *message) {
87
58
char buffer[BUF_BYTES] = " " ;
0 commit comments