Diff
Modified: trunk/Source/WTF/ChangeLog (221220 => 221221)
--- trunk/Source/WTF/ChangeLog 2017-08-26 02:49:55 UTC (rev 221220)
+++ trunk/Source/WTF/ChangeLog 2017-08-26 03:30:41 UTC (rev 221221)
@@ -1,3 +1,13 @@
+2017-08-25 Eric Carlson <[email protected]>
+
+ Add Logger::logAlways
+ https://bugs.webkit.org/show_bug.cgi?id=175996
+
+ Reviewed by Jer Noble.
+
+ * wtf/Assertions.cpp:
+ * wtf/Assertions.h:
+
2017-08-25 Daniel Bates <[email protected]>
Demarcate code added due to lack of NSDMI for aggregates
Modified: trunk/Source/WTF/wtf/Assertions.cpp (221220 => 221221)
--- trunk/Source/WTF/wtf/Assertions.cpp 2017-08-26 02:49:55 UTC (rev 221220)
+++ trunk/Source/WTF/wtf/Assertions.cpp 2017-08-26 03:30:41 UTC (rev 221221)
@@ -413,7 +413,6 @@
void WTFSetLogChannelLevel(WTFLogChannel* channel, WTFLogLevel level)
{
channel->level = level;
- WTFLog(channel, "Channel \"%s\" level set to %i", channel->name, level);
}
bool WTFWillLogWithLevel(WTFLogChannel* channel, WTFLogLevel level)
@@ -423,10 +422,10 @@
void WTFLogWithLevel(WTFLogChannel* channel, WTFLogLevel level, const char* format, ...)
{
- if (channel->level < level)
+ if (level != WTFLogLevelAlways && level > channel->level)
return;
- if (channel->state == WTFLogChannelOff)
+ if (channel->level != WTFLogLevelAlways && channel->state == WTFLogChannelOff)
return;
va_list args;
Modified: trunk/Source/WTF/wtf/Assertions.h (221220 => 221221)
--- trunk/Source/WTF/wtf/Assertions.h 2017-08-26 02:49:55 UTC (rev 221220)
+++ trunk/Source/WTF/wtf/Assertions.h 2017-08-26 03:30:41 UTC (rev 221221)
@@ -148,7 +148,7 @@
#endif
typedef enum { WTFLogChannelOff, WTFLogChannelOn, WTFLogChannelOnWithAccumulation } WTFLogChannelState;
-typedef enum { WTFLogLevelError, WTFLogLevelWarning, WTFLogLevelNotice, WTFLogLevelInfo, WTFLogLevelDebug } WTFLogLevel;
+typedef enum { WTFLogLevelAlways, WTFLogLevelError, WTFLogLevelWarning, WTFLogLevelNotice, WTFLogLevelInfo, WTFLogLevelDebug } WTFLogLevel;
typedef struct {
WTFLogChannelState state;
Modified: trunk/Source/WebCore/PAL/ChangeLog (221220 => 221221)
--- trunk/Source/WebCore/PAL/ChangeLog 2017-08-26 02:49:55 UTC (rev 221220)
+++ trunk/Source/WebCore/PAL/ChangeLog 2017-08-26 03:30:41 UTC (rev 221221)
@@ -1,3 +1,21 @@
+2017-08-25 Eric Carlson <[email protected]>
+
+ Add Logger::logAlways
+ https://bugs.webkit.org/show_bug.cgi?id=175996
+
+ Reviewed by Jer Noble.
+
+ * PAL.xcodeproj/project.pbxproj:
+ * pal/Logger.h:
+ (PAL::Logger::willLog const):
+ (PAL::Logger::willLog const):
+ (PAL::Logger::logAlways): Added.
+ (PAL::Logger::error const): Add missing WTF_ATTRIBUTE_PRINTF.
+ (PAL::Logger::warning const): Ditto.
+ (PAL::Logger::notice const): Ditto.
+ (PAL::Logger::info const): Ditto.
+ (PAL::Logger::debug const): Use String::formatWithArguments.
+
2017-08-25 Jonathan Bedard <[email protected]>
Fix build breakage with Public iOS 11 SDK
Modified: trunk/Source/WebCore/PAL/pal/Logger.h (221220 => 221221)
--- trunk/Source/WebCore/PAL/pal/Logger.h 2017-08-26 02:49:55 UTC (rev 221220)
+++ trunk/Source/WebCore/PAL/pal/Logger.h 2017-08-26 03:30:41 UTC (rev 221221)
@@ -42,8 +42,24 @@
}
template<typename... Arguments>
- inline void error(WTFLogChannel& channel, const char* format, const Arguments&... arguments) const
+ inline void logAlways(WTFLogChannel& channel, const char* format, const Arguments&... arguments) const WTF_ATTRIBUTE_PRINTF(3, 0)
{
+#if RELEASE_LOG_DISABLED
+ // "Standard" WebCore logging goes to stderr, which is captured in layout test output and can generally be a problem
+ // on some systems, so don't allow it.
+ UNUSED_PARAM(channel);
+ UNUSED_PARAM(format);
+#else
+ if (!willLog(channel, WTFLogLevelAlways))
+ return;
+
+ log(channel, format, arguments...);
+#endif
+ }
+
+ template<typename... Arguments>
+ inline void error(WTFLogChannel& channel, const char* format, const Arguments&... arguments) const WTF_ATTRIBUTE_PRINTF(3, 0)
+ {
if (!willLog(channel, WTFLogLevelError))
return;
@@ -51,7 +67,7 @@
}
template<typename... Arguments>
- inline void warning(WTFLogChannel& channel, const char* format, const Arguments&... arguments) const
+ inline void warning(WTFLogChannel& channel, const char* format, const Arguments&... arguments) const WTF_ATTRIBUTE_PRINTF(3, 0)
{
if (!willLog(channel, WTFLogLevelWarning))
return;
@@ -60,7 +76,7 @@
}
template<typename... Arguments>
- inline void notice(WTFLogChannel& channel, const char* format, const Arguments&... arguments) const
+ inline void notice(WTFLogChannel& channel, const char* format, const Arguments&... arguments) const WTF_ATTRIBUTE_PRINTF(3, 0)
{
if (!willLog(channel, WTFLogLevelNotice))
return;
@@ -69,7 +85,7 @@
}
template<typename... Arguments>
- inline void info(WTFLogChannel& channel, const char* format, const Arguments&... arguments) const
+ inline void info(WTFLogChannel& channel, const char* format, const Arguments&... arguments) const WTF_ATTRIBUTE_PRINTF(3, 0)
{
if (!willLog(channel, WTFLogLevelInfo))
return;
@@ -78,7 +94,7 @@
}
template<typename... Arguments>
- inline void debug(WTFLogChannel& channel, const char* format, const Arguments&... arguments) const
+ inline void debug(WTFLogChannel& channel, const char* format, const Arguments&... arguments) const WTF_ATTRIBUTE_PRINTF(3, 0)
{
if (!willLog(channel, WTFLogLevelDebug))
return;
@@ -88,7 +104,13 @@
inline bool willLog(WTFLogChannel& channel, WTFLogLevel level) const
{
- return m_enabled && channel.level >= level && channel.state != WTFLogChannelOff;
+ if (level != WTFLogLevelAlways && level > channel.level)
+ return false;
+
+ if (channel.level != WTFLogLevelAlways && channel.state == WTFLogChannelOff)
+ return false;
+
+ return m_enabled;
}
bool enabled() const { return m_enabled; }
@@ -107,22 +129,21 @@
va_list arguments;
va_start(arguments, format);
-#if COMPILER(CLANG)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wformat-nonliteral"
+#if COMPILER(GCC_OR_CLANG)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#endif
+ String string = String::formatWithArguments(format, arguments);
+#if COMPILER(GCC_OR_CLANG)
+#pragma GCC diagnostic pop
+#endif
#if RELEASE_LOG_DISABLED
- WTFLog(&channel, format, arguments);
+ WTFLog(&channel, "%s", string.utf8().data());
#else
- String string = String::format(format, arguments);
os_log(channel.osLogChannel, "%{public}s", string.utf8().data());
#endif
-#if COMPILER(CLANG)
-#pragma clang diagnostic pop
-#endif
-
va_end(arguments);
}
Modified: trunk/Tools/ChangeLog (221220 => 221221)
--- trunk/Tools/ChangeLog 2017-08-26 02:49:55 UTC (rev 221220)
+++ trunk/Tools/ChangeLog 2017-08-26 03:30:41 UTC (rev 221221)
@@ -1,3 +1,13 @@
+2017-08-25 Eric Carlson <[email protected]>
+
+ Add Logger::logAlways
+ https://bugs.webkit.org/show_bug.cgi?id=175996
+
+ Reviewed by Jer Noble.
+
+ * TestWebKitAPI/Tests/WebCore/Logging.cpp:
+ (TestWebKitAPI::TEST_F):
+
2017-08-25 Alex Christensen <[email protected]>
Disable saveDataToFile API test.
Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/Logging.cpp (221220 => 221221)
--- trunk/Tools/TestWebKitAPI/Tests/WebCore/Logging.cpp 2017-08-26 02:49:55 UTC (rev 221220)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/Logging.cpp 2017-08-26 03:30:41 UTC (rev 221221)
@@ -135,14 +135,6 @@
EXPECT_EQ(TestChannel3.level, WTFLogLevelInfo);
EXPECT_EQ(TestChannel4.level, WTFLogLevelDebug);
-#if TEST_OUTPUT
- WTFSetLogChannelLevel(&TestChannel1, WTFLogLevelError);
- EXPECT_TRUE(output().contains("Channel \"Channel1\" level set to 0", false));
-
- WTFSetLogChannelLevel(&TestChannel2, WTFLogLevelWarning);
- EXPECT_TRUE(output().contains("Channel \"Channel2\" level set to 1", false));
-#endif
-
WTFInitializeLogChannelStatesFromString(testLogChannels, logChannelCount, "-all");
EXPECT_EQ(TestChannel1.state, WTFLogChannelOff);
EXPECT_EQ(TestChannel2.state, WTFLogChannelOff);
@@ -275,8 +267,8 @@
EXPECT_TRUE(logger->enabled());
WTFSetLogChannelLevel(&TestChannel1, WTFLogLevelError);
- logger->error(TestChannel1, "What, Ridden on a horse?");
- EXPECT_TRUE(output().contains("horse?", false));
+ logger->error(TestChannel1, "%s %s", "What,", "ridden on a horse?");
+ EXPECT_TRUE(output().contains("What, ridden on a horse?", false));
logger->warning(TestChannel1, "You're using coconuts!");
EXPECT_EQ(0u, output().length());
@@ -291,8 +283,21 @@
EXPECT_FALSE(logger->enabled());
logger->error(TestChannel1, "You've got two empty halves of coconuts");
EXPECT_EQ(0u, output().length());
+
+ logger->setEnabled(this, true);
+ EXPECT_TRUE(logger->enabled());
+ logger->error(TestChannel1, "%s %s", "You've got two empty halves of", "coconuts!");
+ EXPECT_TRUE(output().contains("You've got two empty halves of coconuts!", false));
+
+ WTFSetLogChannelLevel(&TestChannel1, WTFLogLevelError);
+ logger->logAlways(TestChannel1, "%s", "I shall taunt you a second time!");
+ EXPECT_TRUE(output().contains("I shall taunt you a second time!", false));
+
+ logger->setEnabled(this, false);
+ EXPECT_FALSE(logger->enabled());
+ logger->logAlways(TestChannel1, "You've got two empty halves of coconuts");
+ EXPECT_EQ(0u, output().length());
}
-
#endif
} // namespace TestWebKitAPI