Skip to content

Commit

Permalink
[darwin-framework-tool] Print the queue name (or a shorter version fo…
Browse files Browse the repository at this point in the history
…r common queues) when logging
  • Loading branch information
vivien-apple committed Dec 9, 2024
1 parent 5f28bd6 commit 90e1183
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions examples/darwin-framework-tool/logging/logging.mm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <algorithm>
#include <cstdio>
#include <lib/support/logging/CHIPLogging.h>
#include <platform/Darwin/DispatchQueueNames.h>
#include <pthread.h>

namespace dft {
Expand Down Expand Up @@ -56,9 +57,17 @@ void LogMessage(MTRLogType type, NSString * component, NSString * message)
int pid = [[NSProcessInfo processInfo] processIdentifier];

auto tid = pthread_mach_thread_np(pthread_self());

fprintf(stdout, "%s%s [%d:%u] [%s]: %s%s\n", loggingColor.UTF8String, formattedDate.UTF8String, pid, tid,
component.UTF8String, message.UTF8String, kLoggingColorEnd.UTF8String);
const char * label = chip::darwin::queues::CurrentLabel();

fprintf(stdout, "%s%s [%d:%u:%s] [%s]: %s%s\n",
loggingColor.UTF8String,
formattedDate.UTF8String,
pid,
tid,
label,
component.UTF8String,
message.UTF8String,
kLoggingColorEnd.UTF8String);
}

void LogRedirectCallback(const char * moduleName, uint8_t category, const char * format, va_list args)
Expand Down

0 comments on commit 90e1183

Please sign in to comment.