Closed christophziegler closed 2 years ago
This is a valid point. @christophziegler what would be the preferred method of resolving this? Option 1) use window.debug of debug print API as is supported by HbbTV specs from 1.1.1 up to current version Option 2) remove logging altogether as it does not provide information on the user interface, and replace it with code comments? A screen logging tool may be a distraction and overload the "Hello World!" example. A separate screen logging tutorial sounds like a better idea.
I agree with Christophe's idea to remove console.log from the samples as it could wrongly suggest that these message would be visibile at the screen. As we do not know how well window.debug is implemented in the devices, my suggestion would be to go for Option 2 and provide code comments
Thanks for your reply @appstream-support. I agree with @david-google's preference for option 2: replace code by comments.
A seperate screen logging tutorial would very useful. Once in place, a link that points to the screen logging tutorial could be added to this tuturial and/or all other tutorials that now use console.log
Thank you Christoph for your feedback. We have taken your suggestion into considerations and updated the tutorials and github repository to use code comments instead of console.log output. I'll close the issue for now.
Please feel encouraged to come up with a suggestion for a debug output tutorial we could add to the developer portal. It doesn't need to be completed. Any draft would be a great start to get the ball rolling.
Many thanks, David
@appstream-support & @david-google, happy to put together some code for a basic screen loggin solution plus documentation. What's the best way to share that with you?
This is great news, Christoph. Thanks a lot. I have shared a Google Doc with you, if you could submit the proposal for the tutorial there, that would be great. (Let me know if you didn't receive the link via email).
For the code: it would be wonderful if we can add the source code to the tutorial repository. Either you submit it via a pull request or you send us the code and @appstream-support adds it to the repository.
Some of the code examples use the
console
object to log error messages, for example: https://developer.hbbtv.org/tutorials/hello-world-application/. To my knowledgeconsole
is not a part of the browser profile defined by the HbbTV specification and the use of it causes, in my experience, some terminals to crash.The tutorials make use of
console
only in those code blocks which are assumed to be only executed in browsers that do not support the HbbTV standard. However, as the tutorials address developers who are new to developing HbbTV apps the prevalence ofconsole.log
orconsole.error
in the code snippets may suggest that the use of theconsole
object in HbbTV applications is good practice.The tutorials should stress that the
console
object should be used carefully or not at all. Also alternatives to console logs should be explained, like for example bespoke logging tools that use the DOM API to display logs on the TV screen. A tutorial could explain how to build a simple screen logging tool.