RESOLVED FIXED 228768
Support WTF logging channels
https://bugs.webkit.org/show_bug.cgi?id=228768
Summary Support WTF logging channels
Myles C. Maxfield
Reported 2021-08-04 02:14:54 PDT
Support WTF logging channels
Attachments
Patch (47.98 KB, patch)
2021-08-04 02:23 PDT, Myles C. Maxfield
ews-feeder: commit-queue-
Patch (48.04 KB, patch)
2021-08-04 02:31 PDT, Myles C. Maxfield
no flags
Patch (47.93 KB, patch)
2021-08-07 02:14 PDT, Myles C. Maxfield
ews-feeder: commit-queue-
Patch (47.99 KB, patch)
2021-08-07 02:22 PDT, Myles C. Maxfield
no flags
Patch (47.84 KB, patch)
2021-08-07 02:24 PDT, Myles C. Maxfield
no flags
Patch (47.62 KB, patch)
2021-08-08 19:28 PDT, Myles C. Maxfield
Hironori.Fujii: review+
Hironori.Fujii: commit-queue-
Myles C. Maxfield
Comment 1 2021-08-04 02:23:11 PDT
Myles C. Maxfield
Comment 2 2021-08-04 02:31:01 PDT
Simon Fraser (smfr)
Comment 3 2021-08-04 10:21:44 PDT
Comment on attachment 434896 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=434896&action=review r- to remove code duplicated between WTF, WebCore and WebKit. > Source/WTF/wtf/Logging.h:57 > +WTF_EXPORT_PRIVATE String logLevelString(); > +bool isLogChannelEnabled(const String& name); > +WTF_EXPORT_PRIVATE void setLogChannelToAccumulate(const String& name); > +WTF_EXPORT_PRIVATE void clearAllLogChannelsToAccumulate(); > +WTF_EXPORT_PRIVATE void initializeLogChannelsIfNecessary(std::optional<String> = std::nullopt); I think you should follow WebCore and put these in LogInitialization.h (there was a reason I split things into two headers, but I forget what it was). I think you can also remove the WebCore and WebKit implementations of these functions, sharing all the code from WTF.
Myles C. Maxfield
Comment 4 2021-08-07 02:14:10 PDT
Myles C. Maxfield
Comment 5 2021-08-07 02:22:23 PDT
Myles C. Maxfield
Comment 6 2021-08-07 02:24:42 PDT
Fujii Hironori
Comment 7 2021-08-07 05:15:30 PDT
Myles C. Maxfield
Comment 8 2021-08-07 11:18:34 PDT
(In reply to Fujii Hironori from comment #7) > You might want to update the documentation. > https://github.com/WebKit/WebKit/blob/main/Introduction.md#logging-in-webkit Yeah, good idea. It looks like nothing that's currently written there is inaccurate with these latest patches, but I can add some more details which will make it more clear how to do things like enable/disable log channels.
Myles C. Maxfield
Comment 9 2021-08-07 11:20:12 PDT
Also, I can add information about how to add a new log channel, which macro to use where, etc.
Myles C. Maxfield
Comment 10 2021-08-07 12:31:46 PDT
Fujii Hironori
Comment 11 2021-08-08 05:43:04 PDT
Comment on attachment 435123 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=435123&action=review > Source/WTF/wtf/MemoryPressureHandler.cpp:56 > +#endif Do you still need to explicitly call WTFInitializeLogChannelStatesFromString for MemoryPressure log channel? I think WTF::logChannels().initializeLogChannelsIfNecessary() does the initialization even for MemoryPressure log channel. > Source/WTF/wtf/unix/LoggingUnix.cpp:38 > + return makeString("-all"_s); This seems unexpected behavior change. This disable all WTF log channels as default if WEBKIT_DEBUG is not set. > Source/WTF/wtf/unix/LoggingUnix.cpp:46 > + return makeString("NotYetImplemented,"_s, logEnv); This seems useless. WTF module doesn't have "NotYetImplemented" log channel.
Myles C. Maxfield
Comment 12 2021-08-08 19:27:34 PDT
Comment on attachment 435123 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=435123&action=review >> Source/WTF/wtf/MemoryPressureHandler.cpp:56 >> +#endif > > Do you still need to explicitly call WTFInitializeLogChannelStatesFromString for MemoryPressure log channel? > I think WTF::logChannels().initializeLogChannelsIfNecessary() does the initialization even for MemoryPressure log channel. Right! Good catch. >> Source/WTF/wtf/unix/LoggingUnix.cpp:38 >> + return makeString("-all"_s); > > This seems unexpected behavior change. This disable all WTF log channels as default if WEBKIT_DEBUG is not set. Right, yes. I copied this from WebCore, but you're right that I shouldn't be changing this behavior. >> Source/WTF/wtf/unix/LoggingUnix.cpp:46 >> + return makeString("NotYetImplemented,"_s, logEnv); > > This seems useless. WTF module doesn't have "NotYetImplemented" log channel. Right.
Myles C. Maxfield
Comment 13 2021-08-08 19:28:12 PDT
Fujii Hironori
Comment 14 2021-08-08 20:37:25 PDT
Comment on attachment 435163 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=435163&action=review LGTM > Source/WTF/wtf/unix/LoggingUnix.cpp:41 > + // To disable logging notImplemented set the DISABLE_NI_WARNING environment variable to 1. Remove this comment.
Myles C. Maxfield
Comment 15 2021-08-09 14:15:05 PDT
Radar WebKit Bug Importer
Comment 16 2021-08-09 14:41:36 PDT
Fujii Hironori
Comment 17 2021-08-09 18:49:04 PDT
(In reply to Myles C. Maxfield from comment #15) > Committed r280795 (240373@main): <https://commits.webkit.org/240373@main> This change caused build failures for Debug builds of Win, GTK and WPE ports. Bug 228938 – [GTK][WPE] REGRESSION(r280795): MemoryPressureHandlerUnix.cpp:45:28: error: ‘LogMemoryPressure’ was not declared in this scope Bug 228937 – [WTF][Win] REGRESSION(r280795) error LNK2019: unresolved external symbol "class WTF::String __cdecl WTF::logLevelString(void)"
Myles C. Maxfield
Comment 18 2021-08-09 20:10:04 PDT
(In reply to Fujii Hironori from comment #17) > (In reply to Myles C. Maxfield from comment #15) > > Committed r280795 (240373@main): <https://commits.webkit.org/240373@main> > > This change caused build failures for Debug builds of Win, GTK and WPE ports. > > Bug 228938 – [GTK][WPE] REGRESSION(r280795): > MemoryPressureHandlerUnix.cpp:45:28: error: ‘LogMemoryPressure’ was not > declared in this scope > Bug 228937 – [WTF][Win] REGRESSION(r280795) error LNK2019: unresolved > external symbol "class WTF::String __cdecl WTF::logLevelString(void)" Oh, no :( EWS was green though :( Thanks for fixing it!!!
Note You need to log in before you can comment on or make changes to this bug.