Changed OutputToDebug to create a CFString at compile-time, rather than runtime
CFStringFromCString is useful, however if we have a static C string, we can use the defined macro CFSTR to create a CFString at runtime instead. Bug: None Change-Id: I54b3f590b3ab07858409af27b817013c98556ded Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/293060 Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Auto-Submit: Seija K. <doremylover123@gmail.com> Cr-Commit-Position: refs/heads/main@{#39341}
This commit is contained in:
parent
8981a6fac3
commit
1a890c13ba
1
AUTHORS
1
AUTHORS
|
@ -111,6 +111,7 @@ Saul Kravitz <Saul.Kravitz@celera.com>
|
|||
Sergio Garcia Murillo <sergio.garcia.murillo@gmail.com>
|
||||
Shaofan Qi <vshaqi@gmail.com>
|
||||
Shuhai Peng <shuhai.peng@intel.com>
|
||||
Seija <doremylover123@gmail.com>
|
||||
Silviu Caragea <silviu.cpp@gmail.com>
|
||||
Stefan Gula <steweg@gmail.com>
|
||||
Stephan Hartmann <stha09@googlemail.com>
|
||||
|
|
|
@ -363,20 +363,16 @@ void LogMessage::OutputToDebug(const LogLineRef& log_line) {
|
|||
// On the Mac, all stderr output goes to the Console log and causes clutter.
|
||||
// So in opt builds, don't log to stderr unless the user specifically sets
|
||||
// a preference to do so.
|
||||
CFStringRef key = CFStringCreateWithCString(
|
||||
kCFAllocatorDefault, "logToStdErr", kCFStringEncodingUTF8);
|
||||
CFStringRef domain = CFBundleGetIdentifier(CFBundleGetMainBundle());
|
||||
if (key != nullptr && domain != nullptr) {
|
||||
if (domain != nullptr) {
|
||||
Boolean exists_and_is_valid;
|
||||
Boolean should_log =
|
||||
CFPreferencesGetAppBooleanValue(key, domain, &exists_and_is_valid);
|
||||
CFPreferencesGetAppBooleanValue(CFSTR("logToStdErr"), domain,
|
||||
&exists_and_is_valid);
|
||||
// If the key doesn't exist or is invalid or is false, we will not log to
|
||||
// stderr.
|
||||
log_to_stderr = exists_and_is_valid && should_log;
|
||||
}
|
||||
if (key != nullptr) {
|
||||
CFRelease(key);
|
||||
}
|
||||
#endif // defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) && defined(NDEBUG)
|
||||
|
||||
#if defined(WEBRTC_WIN)
|
||||
|
|
Loading…
Reference in New Issue