Skip to content

Commit ba69465

Browse files
Pawel Lampeasurdej-comcast
authored andcommitted
Fix public/private strings in logs
1 parent 0febd94 commit ba69465

46 files changed

Lines changed: 167 additions & 164 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Source/JavaScriptCore/runtime/JSGlobalObject.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ JSC_DEFINE_HOST_FUNCTION(signpostStart, (JSGlobalObject* globalObject, CallFrame
509509
auto message = asSignpostString(globalObject, callFrame->argument(0));
510510
RETURN_IF_EXCEPTION(scope, EncodedJSValue());
511511

512-
WTFBeginSignpost(globalObject, "JSGlobalObject signpost", "%{public}s", message.ascii().data());
512+
WTFBeginSignpost(globalObject, "JSGlobalObject signpost", "%" PUBLIC_LOG_STRING, message.ascii().data());
513513

514514
return JSValue::encode(jsUndefined());
515515
}
@@ -522,7 +522,7 @@ JSC_DEFINE_HOST_FUNCTION(signpostStop, (JSGlobalObject* globalObject, CallFrame*
522522
auto message = asSignpostString(globalObject, callFrame->argument(0));
523523
RETURN_IF_EXCEPTION(scope, EncodedJSValue());
524524

525-
WTFEndSignpost(globalObject, "JSGlobalObject signpost", "%{public}s", message.ascii().data());
525+
WTFEndSignpost(globalObject, "JSGlobalObject signpost", "%" PUBLIC_LOG_STRING, message.ascii().data());
526526

527527
return JSValue::encode(jsUndefined());
528528
}

Source/ThirdParty/libwebrtc/Source/webrtc/examples/objc/AppRTCMobile/ios/broadcast_extension/ARDBroadcastSampleHandler.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ - (instancetype)init {
3030
_callbackLogger = [[RTC_OBJC_TYPE(RTCCallbackLogger) alloc] init];
3131
os_log_t rtc_os_log = os_log_create("com.google.AppRTCMobile", "RTCLog");
3232
[_callbackLogger start:^(NSString *logMessage) {
33-
os_log(rtc_os_log, "%{public}s", [logMessage cStringUsingEncoding:NSUTF8StringEncoding]);
33+
os_log(rtc_os_log, "%" PUBLIC_LOG_STRING, [logMessage cStringUsingEncoding:NSUTF8StringEncoding]);
3434
}];
3535
}
3636
return self;

Source/WTF/wtf/Assertions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,9 +607,9 @@ void WTFReleaseLogStackTrace(WTFLogChannel* channel)
607607
auto demangled = WTF::StackTrace::demangle(stackFrame);
608608
#if USE(OS_LOG)
609609
if (demangled && demangled->demangledName())
610-
os_log(channel->osLogChannel, "%-3d %p %{public}s", frameNumber, stackFrame, demangled->demangledName());
610+
os_log(channel->osLogChannel, "%-3d %p %" PUBLIC_LOG_STRING, frameNumber, stackFrame, demangled->demangledName());
611611
else if (demangled && demangled->mangledName())
612-
os_log(channel->osLogChannel, "%-3d %p %{public}s", frameNumber, stackFrame, demangled->mangledName());
612+
os_log(channel->osLogChannel, "%-3d %p %" PUBLIC_LOG_STRING, frameNumber, stackFrame, demangled->mangledName());
613613
else
614614
os_log(channel->osLogChannel, "%-3d %p", frameNumber, stackFrame);
615615
#else

Source/WTF/wtf/Assertions.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,8 @@ constexpr bool assertionFailureDueToUnreachableCode = false;
551551

552552
#if RELEASE_LOG_DISABLED
553553

554-
#define PUBLIC_LOG_STRING "s"
555-
#define PRIVATE_LOG_STRING "s"
554+
#define PUBLIC_LOG_PREFIX ""
555+
#define PRIVATE_LOG_PREFIX ""
556556
#define RELEASE_LOG(channel, ...) ((void)0)
557557
#define RELEASE_LOG_ERROR(channel, ...) LOG_ERROR(__VA_ARGS__)
558558
#define RELEASE_LOG_FAULT(channel, ...) LOG_ERROR(__VA_ARGS__)
@@ -569,8 +569,8 @@ constexpr bool assertionFailureDueToUnreachableCode = false;
569569

570570
#elif USE(OS_LOG)
571571

572-
#define PUBLIC_LOG_STRING "{public}s"
573-
#define PRIVATE_LOG_STRING "{private}s"
572+
#define PUBLIC_LOG_PREFIX "{public}"
573+
#define PRIVATE_LOG_PREFIX "{private}"
574574
#define RELEASE_LOG(channel, ...) os_log(LOG_CHANNEL(channel).osLogChannel, __VA_ARGS__)
575575
#define RELEASE_LOG_ERROR(channel, ...) os_log_error(LOG_CHANNEL(channel).osLogChannel, __VA_ARGS__)
576576
#define RELEASE_LOG_FAULT(channel, ...) os_log_fault(LOG_CHANNEL(channel).osLogChannel, __VA_ARGS__)
@@ -587,8 +587,8 @@ constexpr bool assertionFailureDueToUnreachableCode = false;
587587

588588
#elif ENABLE(JOURNALD_LOG)
589589

590-
#define PUBLIC_LOG_STRING "s"
591-
#define PRIVATE_LOG_STRING "s"
590+
#define PUBLIC_LOG_PREFIX ""
591+
#define PRIVATE_LOG_PREFIX ""
592592
#define SD_JOURNAL_SEND(channel, priority, file, line, function, ...) do { \
593593
if (LOG_CHANNEL(channel).state != WTFLogChannelState::Off) \
594594
sd_journal_send_with_location("CODE_FILE=" file, "CODE_LINE=" line, function, "WEBKIT_SUBSYSTEM=%s", LOG_CHANNEL(channel).subsystem, "WEBKIT_CHANNEL=%s", LOG_CHANNEL(channel).name, "PRIORITY=%i", priority, "MESSAGE=" __VA_ARGS__, nullptr); \
@@ -613,8 +613,8 @@ constexpr bool assertionFailureDueToUnreachableCode = false;
613613

614614
#else
615615

616-
#define PUBLIC_LOG_STRING "s"
617-
#define PRIVATE_LOG_STRING "s"
616+
#define PUBLIC_LOG_PREFIX ""
617+
#define PRIVATE_LOG_PREFIX ""
618618
#define LOGF(channel, priority, fmt, ...) do { \
619619
auto& logChannel = LOG_CHANNEL(channel); \
620620
if (logChannel.state != WTFLogChannelState::Off) \
@@ -638,6 +638,9 @@ constexpr bool assertionFailureDueToUnreachableCode = false;
638638

639639
#endif
640640

641+
#define PUBLIC_LOG_STRING PUBLIC_LOG_PREFIX "s"
642+
#define PRIVATE_LOG_STRING PRIVATE_LOG_PREFIX "s"
643+
641644
#if !RELEASE_LOG_DISABLED
642645
#define RELEASE_LOG_STACKTRACE(channel) WTFReleaseLogStackTrace(&LOG_CHANNEL(channel))
643646
#define RELEASE_LOG_IF(isAllowed, channel, ...) do { if (isAllowed) RELEASE_LOG(channel, __VA_ARGS__); } while (0)

Source/WTF/wtf/Logger.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ class Logger : public ThreadSafeRefCounted<Logger> {
313313
#if RELEASE_LOG_DISABLED
314314
WTFLog(&channel, "%s", logMessage.utf8().data());
315315
#elif USE(OS_LOG)
316-
os_log(channel.osLogChannel, "%{public}s", logMessage.utf8().data());
316+
os_log(channel.osLogChannel, "%" PUBLIC_LOG_STRING, logMessage.utf8().data());
317317
#elif ENABLE(JOURNALD_LOG)
318318
sd_journal_send("WEBKIT_SUBSYSTEM=%s", channel.subsystem, "WEBKIT_CHANNEL=%s", channel.name, "MESSAGE=%s", logMessage.utf8().data(), nullptr);
319319
#else
@@ -339,7 +339,7 @@ class Logger : public ThreadSafeRefCounted<Logger> {
339339
#if RELEASE_LOG_DISABLED
340340
WTFLogVerbose(file, line, function, &channel, "%s", logMessage.utf8().data());
341341
#elif USE(OS_LOG)
342-
os_log(channel.osLogChannel, "%{public}s", logMessage.utf8().data());
342+
os_log(channel.osLogChannel, "%" PUBLIC_LOG_STRING, logMessage.utf8().data());
343343
UNUSED_PARAM(file);
344344
UNUSED_PARAM(line);
345345
UNUSED_PARAM(function);

Source/WTF/wtf/OSLogPrintStream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void OSLogPrintStream::vprintf(const char* format, va_list argList)
6969
if (buffer[offset] == '\n') {
7070
// Set the new line to a null character so os_log stops copying there.
7171
buffer[offset] = '\0';
72-
os_log_with_type(m_log, m_logType, "%{public}s", buffer);
72+
os_log_with_type(m_log, m_logType, "%" PUBLIC_LOG_STRING, buffer);
7373
buffer += offset + 1;
7474
newOffset -= offset + 1;
7575
offset = 0;

Source/WTF/wtf/cocoa/MachSendRight.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void deallocateSendRightSafely(mach_port_t port)
6767
if (kr == KERN_SUCCESS)
6868
return;
6969

70-
RELEASE_LOG_ERROR(Process, "mach_port_deallocate error for port %d: %{private}s (%#x)", port, mach_error_string(kr), kr);
70+
RELEASE_LOG_ERROR(Process, "mach_port_deallocate error for port %d: %" PRIVATE_LOG_STRING " (%#x)", port, mach_error_string(kr), kr);
7171
if (kr == KERN_INVALID_RIGHT || kr == KERN_INVALID_NAME)
7272
CRASH();
7373
}
@@ -85,7 +85,7 @@ static void assertSendRight(mach_port_t port)
8585
if (kr == KERN_SUCCESS && count > 0)
8686
return;
8787

88-
RELEASE_LOG_ERROR(Process, "mach_port_get_refs error for port %d: %{private}s (%#x)", port, mach_error_string(kr), kr);
88+
RELEASE_LOG_ERROR(Process, "mach_port_get_refs error for port %d: %" PRIVATE_LOG_STRING " (%#x)", port, mach_error_string(kr), kr);
8989
CRASH();
9090
}
9191

Source/WebCore/dom/ScriptElement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ void ScriptElement::executeClassicScript(const ScriptSourceCode& sourceCode)
396396
IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrementer(m_isExternalScript ? &document : nullptr);
397397
CurrentScriptIncrementer currentScriptIncrementer(document, *this);
398398

399-
WTFBeginSignpost(this, "Execute Script Element", "executing classic script from URL: %{public}s async: %d defer: %d", m_isExternalScript ? sourceCode.url().string().utf8().data() : "inline", hasAsyncAttribute(), hasDeferAttribute());
399+
WTFBeginSignpost(this, "Execute Script Element", "executing classic script from URL: %" PUBLIC_LOG_STRING " async: %d defer: %d", m_isExternalScript ? sourceCode.url().string().utf8().data() : "inline", hasAsyncAttribute(), hasDeferAttribute());
400400
frame->script().evaluateIgnoringException(sourceCode);
401401
WTFEndSignpost(this, "Execute Script Element");
402402
}

Source/WebCore/platform/ProcessIdentity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ ProcessIdentity::ProcessIdentity(CurrentProcessTag)
4242
if (kr == KERN_SUCCESS)
4343
m_taskIdToken = MachSendRight::adopt(identityToken);
4444
else
45-
RELEASE_LOG_ERROR(Process, "task_create_identity_token() failed: %{private}s (%x)", mach_error_string(kr), kr);
45+
RELEASE_LOG_ERROR(Process, "task_create_identity_token() failed: %" PRIVATE_LOG_STRING " (%x)", mach_error_string(kr), kr);
4646
#endif
4747
}
4848

Source/WebCore/platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static void runWithoutAnimations(const WTF::Function<void()>& function)
214214
{
215215
ASSERT(isMainThread());
216216
if (m_client && m_sampleBufferDisplayLayer.get().status == AVQueuedSampleBufferRenderingStatusFailed) {
217-
RELEASE_LOG_ERROR(WebRTC, "LocalSampleBufferDisplayLayer::layerStatusDidChange going to failed status (%{public}s) ", m_logIdentifier.utf8().data());
217+
RELEASE_LOG_ERROR(WebRTC, "LocalSampleBufferDisplayLayer::layerStatusDidChange going to failed status (%" PUBLIC_LOG_STRING ") ", m_logIdentifier.utf8().data());
218218
if (!m_didFail) {
219219
m_didFail = true;
220220
m_client->sampleBufferDisplayLayerStatusDidFail();
@@ -225,7 +225,7 @@ static void runWithoutAnimations(const WTF::Function<void()>& function)
225225
void LocalSampleBufferDisplayLayer::layerErrorDidChange()
226226
{
227227
ASSERT(isMainThread());
228-
RELEASE_LOG_ERROR(WebRTC, "LocalSampleBufferDisplayLayer::layerErrorDidChange (%{public}s) ", m_logIdentifier.utf8().data());
228+
RELEASE_LOG_ERROR(WebRTC, "LocalSampleBufferDisplayLayer::layerErrorDidChange (%" PUBLIC_LOG_STRING ") ", m_logIdentifier.utf8().data());
229229
if (!m_client || m_didFail)
230230
return;
231231
m_didFail = true;
@@ -344,7 +344,7 @@ static void runWithoutAnimations(const WTF::Function<void()>& function)
344344

345345
m_processingQueue->dispatch([this, videoFrame = Ref { videoFrame }]() mutable {
346346
if (![m_sampleBufferDisplayLayer isReadyForMoreMediaData]) {
347-
RELEASE_LOG(WebRTC, "LocalSampleBufferDisplayLayer::enqueueSample (%{public}s) not ready for more media data", m_logIdentifier.utf8().data());
347+
RELEASE_LOG(WebRTC, "LocalSampleBufferDisplayLayer::enqueueSample (%" PUBLIC_LOG_STRING ") not ready for more media data", m_logIdentifier.utf8().data());
348348
addVideoFrameToPendingQueue(WTFMove(videoFrame));
349349
requestNotificationWhenReadyForVideoData();
350350
return;
@@ -377,7 +377,7 @@ static void setSampleBufferAsDisplayImmediately(CMSampleBufferRef sampleBuffer)
377377
constexpr size_t frameCountPerLog = 1800; // log every minute at 30 fps
378378
if (!(m_frameRateMonitor.frameCount() % frameCountPerLog)) {
379379
if (auto* metrics = [m_sampleBufferDisplayLayer videoPerformanceMetrics])
380-
RELEASE_LOG(WebRTC, "LocalSampleBufferDisplayLayer (%{public}s) metrics, total=%lu, dropped=%lu, corrupted=%lu, display-composited=%lu, non-display-composited=%lu (pending=%lu)", m_logIdentifier.utf8().data(), metrics.totalNumberOfVideoFrames, metrics.numberOfDroppedVideoFrames, metrics.numberOfCorruptedVideoFrames, metrics.numberOfDisplayCompositedVideoFrames, metrics.numberOfNonDisplayCompositedVideoFrames, m_pendingVideoFrameQueue.size());
380+
RELEASE_LOG(WebRTC, "LocalSampleBufferDisplayLayer (%" PUBLIC_LOG_STRING ") metrics, total=%lu, dropped=%lu, corrupted=%lu, display-composited=%lu, non-display-composited=%lu (pending=%lu)", m_logIdentifier.utf8().data(), metrics.totalNumberOfVideoFrames, metrics.numberOfDroppedVideoFrames, metrics.numberOfCorruptedVideoFrames, metrics.numberOfDisplayCompositedVideoFrames, metrics.numberOfNonDisplayCompositedVideoFrames, m_pendingVideoFrameQueue.size());
381381
}
382382
m_frameRateMonitor.update();
383383
#endif
@@ -389,7 +389,7 @@ static void setSampleBufferAsDisplayImmediately(CMSampleBufferRef sampleBuffer)
389389
callOnMainThread([frameTime = frameTime.secondsSinceEpoch().value(), lastFrameTime = lastFrameTime.secondsSinceEpoch().value(), observedFrameRate = m_frameRateMonitor.observedFrameRate(), frameCount = m_frameRateMonitor.frameCount(), weakThis = WeakPtr { *this }] {
390390
if (!weakThis)
391391
return;
392-
RELEASE_LOG(WebRTC, "LocalSampleBufferDisplayLayer::enqueueVideoFrame (%{public}s) at %f, previous frame was at %f, observed frame rate is %f, delay since last frame is %f ms, frame count is %lu", weakThis->m_logIdentifier.utf8().data(), frameTime, lastFrameTime, observedFrameRate, (frameTime - lastFrameTime) * 1000, frameCount);
392+
RELEASE_LOG(WebRTC, "LocalSampleBufferDisplayLayer::enqueueVideoFrame (%" PUBLIC_LOG_STRING ") at %f, previous frame was at %f, observed frame rate is %f, delay since last frame is %f ms, frame count is %lu", weakThis->m_logIdentifier.utf8().data(), frameTime, lastFrameTime, observedFrameRate, (frameTime - lastFrameTime) * 1000, frameCount);
393393
});
394394
}
395395
#endif

0 commit comments

Comments
 (0)