Skip to content

Commit ff93e5e

Browse files
committed
Print domain and task names in log prefix.
1 parent f307688 commit ff93e5e

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/rt/rust_log.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,22 @@ rust_log::trace_ln(rust_task *task, char *message) {
145145
#if defined(__WIN32__)
146146
uint32_t thread_id = 0;
147147
#else
148-
uint32_t thread_id = (uint32_t) pthread_self();
148+
uint32_t thread_id = hash((uint32_t) pthread_self());
149149
#endif
150150
char prefix[1024] = "";
151-
append_string(prefix, "0x%08" PRIxPTR ":0x%08" PRIxPTR ":",
152-
thread_id, (uintptr_t) _dom);
151+
if (_dom->name) {
152+
append_string(prefix, "%04" PRIxPTR ":%.10s:",
153+
thread_id, _dom->name);
154+
} else {
155+
append_string(prefix, "%04" PRIxPTR ":0x%08" PRIxPTR ":",
156+
thread_id, (uintptr_t) _dom);
157+
}
153158
if (task) {
154-
append_string(prefix, "0x%08" PRIxPTR ":", (uintptr_t) task);
159+
if (task->name) {
160+
append_string(prefix, "%.10s:", task->name);
161+
} else {
162+
append_string(prefix, "0x%08" PRIxPTR ":", (uintptr_t) task);
163+
}
155164
}
156165
trace_ln(thread_id, prefix, message);
157166
}

0 commit comments

Comments
 (0)