RESOLVED FIXED 210564
Add logging to core accessibility.
https://bugs.webkit.org/show_bug.cgi?id=210564
Summary Add logging to core accessibility.
Andres Gonzalez
Reported 2020-04-15 12:40:00 PDT
Add logging to core accessibility.
Attachments
Patch (16.90 KB, patch)
2020-04-15 12:45 PDT, Andres Gonzalez
no flags
Patch (2.61 KB, patch)
2020-04-16 11:50 PDT, Andres Gonzalez
no flags
Patch (3.57 KB, patch)
2020-04-20 14:25 PDT, Andres Gonzalez
no flags
Patch (18.53 KB, patch)
2020-04-21 07:25 PDT, Andres Gonzalez
no flags
Patch (18.69 KB, patch)
2020-04-22 08:16 PDT, Andres Gonzalez
no flags
Patch (18.72 KB, patch)
2020-04-22 10:28 PDT, Andres Gonzalez
no flags
Patch (18.76 KB, patch)
2020-04-22 14:03 PDT, Andres Gonzalez
no flags
Andres Gonzalez
Comment 1 2020-04-15 12:45:32 PDT
EWS
Comment 2 2020-04-15 19:19:18 PDT
Committed r260168: <https://trac.webkit.org/changeset/260168> All reviewed patches have been landed. Closing bug and clearing flags on attachment 396561 [details].
Radar WebKit Bug Importer
Comment 3 2020-04-15 19:20:16 PDT
Simon Fraser (smfr)
Comment 4 2020-04-15 20:14:47 PDT
Was there a reason not to use the usual LOG and LOG_WITH_STREAM macros?
Andres Gonzalez
Comment 5 2020-04-16 09:25:49 PDT
(In reply to Simon Fraser (smfr) from comment #4) > Was there a reason not to use the usual LOG and LOG_WITH_STREAM macros? Thanks Simon. Part of the reason is my ignorance, didn't know that that was the usual way. So I went ahead and made the change to use those macros, to find out that they log to the standard output and not to the system log stream. We want to be able moving forward to log to the system log, not just to the std output. If there is a way to use the LOG macros to log to the system log, please let me know. Thanks again.
Simon Fraser (smfr)
Comment 6 2020-04-16 11:15:20 PDT
If you're logging to system log, in release builds, you need to use the RELEASE_LOG macros. This is important because the logged data needs to undergo privacy review.
Andres Gonzalez
Comment 7 2020-04-16 11:50:04 PDT
Reopening to attach new patch.
Andres Gonzalez
Comment 8 2020-04-16 11:50:06 PDT
Andres Gonzalez
Comment 9 2020-04-16 11:52:46 PDT
(In reply to Simon Fraser (smfr) from comment #6) > If you're logging to system log, in release builds, you need to use the > RELEASE_LOG macros. > > This is important because the logged data needs to undergo privacy review. Got it, using LOG macros in latest review. Thanks again.
Simon Fraser (smfr)
Comment 10 2020-04-16 21:55:46 PDT
Comment on attachment 396681 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=396681&action=review > Source/WebCore/accessibility/AXLogger.cpp:41 > + channel->state = WTFLogChannelState::On; Does this turn on accessibility logging for everyone? We certainly don't want that.
Andres Gonzalez
Comment 11 2020-04-20 14:25:13 PDT
Simon Fraser (smfr)
Comment 12 2020-04-20 16:08:54 PDT
Comment on attachment 397016 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=397016&action=review > Source/WebCore/accessibility/AXLogger.cpp:64 > + stream << "objectID: " << object.objectID() << " {\n"; > + stream << "role: " << static_cast<unsigned>(object.roleValue()) << "\n"; > + stream << "}"; There are "dumpProperty" helpers that output something like this format. Also instead of static_cast<unsigned>(object.roleValue()) you should implement WTF::TextStream& operator<<(WTF::TextStream&, AccessibilityRole); Better yet, implement WTF::TextStream& operator<<(WTF::TextStream&, const AXCoreObject&); and you don't need this function at all.
Andres Gonzalez
Comment 13 2020-04-21 07:25:27 PDT
Andres Gonzalez
Comment 14 2020-04-21 07:32:47 PDT
(In reply to Simon Fraser (smfr) from comment #12) > Comment on attachment 397016 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=397016&action=review > > > Source/WebCore/accessibility/AXLogger.cpp:64 > > + stream << "objectID: " << object.objectID() << " {\n"; > > + stream << "role: " << static_cast<unsigned>(object.roleValue()) << "\n"; > > + stream << "}"; > > There are "dumpProperty" helpers that output something like this format. Using dumpProperty. > > Also instead of static_cast<unsigned>(object.roleValue()) you should > implement WTF::TextStream& operator<<(WTF::TextStream&, AccessibilityRole); Done. > > Better yet, implement WTF::TextStream& operator<<(WTF::TextStream&, const > AXCoreObject&); and you don't need this function at all. Done. But still need this function to be able to write AXLOG(axCoreObject). Thanks.
Simon Fraser (smfr)
Comment 15 2020-04-21 20:11:10 PDT
Too much red to review.
chris fleizach
Comment 16 2020-04-21 22:15:37 PDT
./accessibility/AXLogger.cpp:53:34: error: unused parameter 'message' [-Werror,-Wunused-parameter]
Andres Gonzalez
Comment 17 2020-04-22 08:16:43 PDT
Andres Gonzalez
Comment 18 2020-04-22 08:21:10 PDT
(In reply to chris fleizach from comment #16) > ./accessibility/AXLogger.cpp:53:34: error: unused parameter 'message' > [-Werror,-Wunused-parameter] Fixed release build. The long function is just one repetitive long switch to provide a logging string for each AccessibilityRole, 151 of them.
Andres Gonzalez
Comment 19 2020-04-22 10:28:56 PDT
Andres Gonzalez
Comment 20 2020-04-22 10:32:39 PDT
(In reply to Andres Gonzalez from comment #19) > Created attachment 397220 [details] > Patch Fix for non-COCOA builds.
Simon Fraser (smfr)
Comment 21 2020-04-22 10:52:18 PDT
Comment on attachment 397220 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=397220&action=review > Source/WebCore/accessibility/AXLogger.cpp:53 > +void AXLogger::log(const String& message) Why do you need this at all? Why not use LOG(Accessibility...) at all the call sites? > Source/WebCore/accessibility/AXLogger.cpp:69 > +TextStream& operator<<(TextStream& stream, const AccessibilityRole& role) AccessibilityRole is just an enum. No need to pass by reference. > Source/WebCore/accessibility/AXLogger.cpp:533 > + stream << "objectID " << object.objectID() << " {"; > + stream.increaseIndent(); Look at GroupScope which will do parens and stream.increaseIndent() for you. > Source/WebCore/accessibility/AXLogger.cpp:541 > + stream.dumpProperty("parentObject", parent ? parent->objectID() : 0); > +#if PLATFORM(COCOA) > + stream.dumpProperty("remoteParentObject", object.remoteParentObject()); > +#endif Seems a bit weird to dump parents. Normally you dump trees from the top down. > Source/WebCore/accessibility/AccessibilityObjectInterface.h:1300 > +WTF::TextStream& operator<<(WTF::TextStream&, const AccessibilityRole&); AccessibilityRole by value
Andres Gonzalez
Comment 22 2020-04-22 14:03:41 PDT
Andres Gonzalez
Comment 23 2020-04-22 14:16:22 PDT
(In reply to Simon Fraser (smfr) from comment #21) > Comment on attachment 397220 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=397220&action=review > > > Source/WebCore/accessibility/AXLogger.cpp:53 > > +void AXLogger::log(const String& message) > > Why do you need this at all? Why not use LOG(Accessibility...) at all the > call sites? It is convenient to always type just AXLOG(x) where x can be a simple string or some other accessibility object. > > > Source/WebCore/accessibility/AXLogger.cpp:69 > > +TextStream& operator<<(TextStream& stream, const AccessibilityRole& role) > > AccessibilityRole is just an enum. No need to pass by reference. Fixed. > > > Source/WebCore/accessibility/AXLogger.cpp:533 > > + stream << "objectID " << object.objectID() << " {"; > > + stream.increaseIndent(); > > Look at GroupScope which will do parens and stream.increaseIndent() for you. Great! Done. > > > Source/WebCore/accessibility/AXLogger.cpp:541 > > + stream.dumpProperty("parentObject", parent ? parent->objectID() : 0); > > +#if PLATFORM(COCOA) > > + stream.dumpProperty("remoteParentObject", object.remoteParentObject()); > > +#endif > > Seems a bit weird to dump parents. Normally you dump trees from the top down. This is the dump for a single object. It just happened that I needed the parent and the remote parent for another bug I was debugging, and then add them to the logger. We'll add more properties to this method as needed. Will also add another method to log the accessibility object hierarchy. > > > Source/WebCore/accessibility/AccessibilityObjectInterface.h:1300 > > +WTF::TextStream& operator<<(WTF::TextStream&, const AccessibilityRole&); > > AccessibilityRole by value Fixed. Thanks!
EWS
Comment 24 2020-04-22 18:22:40 PDT
Committed r260548: <https://trac.webkit.org/changeset/260548> All reviewed patches have been landed. Closing bug and clearing flags on attachment 397258 [details].
Note You need to log in before you can comment on or make changes to this bug.