13
13
* Synchronizes access to the underlying logging mechanism.
14
14
*/
15
15
static lock_and_signal _log_lock;
16
- static uint32_t _last_thread_id;
17
16
18
17
rust_log::rust_log (rust_srv *srv, rust_scheduler *sched) :
19
18
_srv(srv),
@@ -67,26 +66,29 @@ append_string(char *buffer, const char *format, ...) {
67
66
}
68
67
69
68
void
70
- rust_log::trace_ln (uint32_t thread_id, char *prefix, char *message) {
69
+ rust_log::trace_ln (char *prefix, char *message) {
71
70
char buffer[BUF_BYTES] = " " ;
72
71
_log_lock.lock ();
73
- append_string (buffer, " %-34s " , prefix);
72
+ append_string (buffer, " %s " , prefix);
74
73
append_string (buffer, " %s" , message);
75
- if (_last_thread_id != thread_id) {
76
- _last_thread_id = thread_id;
77
- _srv->log (" ---" );
78
- }
79
74
_srv->log (buffer);
80
75
_log_lock.unlock ();
81
76
}
82
77
83
78
void
84
79
rust_log::trace_ln (rust_task *task, uint32_t level, char *message) {
80
+
81
+
82
+ // FIXME: The scheduler and task names used to have meaning,
83
+ // but they are always equal to 'main' currently
84
+ #if 0
85
+
85
86
#if defined(__WIN32__)
86
87
uint32_t thread_id = 0;
87
88
#else
88
89
uint32_t thread_id = hash((uintptr_t) pthread_self());
89
90
#endif
91
+
90
92
char prefix[BUF_BYTES] = "";
91
93
if (_sched && _sched->name) {
92
94
append_string(prefix, "%04" PRIxPTR ":%.10s:",
@@ -102,7 +104,11 @@ rust_log::trace_ln(rust_task *task, uint32_t level, char *message) {
102
104
append_string(prefix, "0x%08" PRIxPTR ":", (uintptr_t) task);
103
105
}
104
106
}
105
- trace_ln (thread_id, prefix, message);
107
+ #else
108
+ char prefix[BUF_BYTES] = " " ;
109
+ #endif
110
+
111
+ trace_ln (prefix, message);
106
112
}
107
113
108
114
// Reading log directives and setting log level vars
0 commit comments