awslabs / amazon-kinesis-video-streams-webrtc-sdk-js

JS SDK for interfacing with the Amazon Kinesis Video Streams Signaling Service.
https://awslabs.github.io/amazon-kinesis-video-streams-webrtc-sdk-js/examples/index.html
Apache License 2.0
286 stars 141 forks source link

Sample QoL: Add button to copy logs #250

Closed sirknightj closed 1 year ago

sirknightj commented 1 year ago

What was changed?

The sample. Added a button to copy the logs.

image

It also has a tooltip:

image

And, when you click on it, the button changes colors and displays a message!

image

Why was it changed?

I (and probably many users) need to copy/paste the logs. Using Ctrl+A selects too much stuff, and scrolling up and down the page is a lot of effort. I added this button to make it easier and quicker to copy/paste the logs.

How was it changed?

When the button is clicked, it loops through all of the children inside of the log container. It grabs the visible elements, appends them together, and adds it to your clipboard.

Testing:

I clicked the button in the following cases:

  1. When there are no logs. I pasted my clipboard into a text editor and it was empty.
  2. When there are logs with an exception, INFO selected. I pasted my clipboard into a text editor and the full logs are copied.
  3. When there are logs with an exception, ERROR selected. I pasted my clipboard into a text editor are none of the INFO logs show up.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.