[py] Implement High Level Logging API with BiDi#14107
Conversation
titusfortner
left a comment
There was a problem hiding this comment.
This is fine for tests, but won't be good enough for our documentation:
add_console_message_handler(log_entries.append)
We should add a test method (I can do it in Ruby) to test filtering, where we only append errors and then click both consoleLog and consoleError buttons. That way we can show how to use lambdas and/or callbacks (and we can just copy those to the docs)
|
Yeah, this isn't really testing the code, just showing how to use it, so maybe we don't need it in specs, just in our docs. What does this look like in the python? |
The equivalent would one of: # simple lambda
errors = []
driver.script.add_console_message_handler(lambda log_entry: if log.level == 'error': errors.append(log_entry) }# function
self.errors = []
def collect_error(log_entry)
if log_entry.level == 'error':
self.errors.append(log_entry)
driver.script.add_console_message_handler(collect_error}# aggregator object
class ErrorsHandler:
def __init__():
self.errors = []
def collect_error(log_entry)
if log_entry.level == 'error':
self.errors.append(log_entry)
errors_handler = ErrorsHandler()
driver.script.add_console_message_handler(errors_handler.collect_error} |
eadb710 to
4676beb
Compare
|
@p0deje I didn't realize you added the options in here. I implemented |
CI Failure Feedback 🧐(Checks updated until commit 16e2e76)
✨ CI feedback usage guide:The CI feedback tool (
In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR: where Configuration options
See more information about the |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #14107 +/- ##
==========================================
- Coverage 57.76% 56.98% -0.79%
==========================================
Files 87 89 +2
Lines 5413 5528 +115
Branches 228 232 +4
==========================================
+ Hits 3127 3150 +23
- Misses 2058 2146 +88
- Partials 228 232 +4 ☔ View full report in Codecov by Sentry. |
eb27327 to
16e2e76
Compare
The commit also generates Bazel test targets for BiDi-backed implementation
Partial Python implementation of #13992, closely mimics Ruby part from #14073