0

Debugging TV Widgets

At the moment, we're using log() to output to the terminal window, but we're finding that we spend a lot of time searching through the window to find our output, because there is so much stuff in there. Is there a way to have log() or print() calls output to a separate window?

by
23 Replies
  • QUOTE (james.cumberbatch @ Jun 26 2009, 03:49 AM) <{POST_SNAPBACK}>
    At the moment, we're using log() to output to the terminal window, but we're finding that we spend a lot of time searching through the window to find our output, because there is so much stuff in there. Is there a way to have log() or print() calls output to a separate window?


    Check out the simulator settings. You can limit the terminal window to just a specific widget by setting the restrict value to your widget ID.

    Hope this helps clean things up. :)
    0
  • This is my start script for use while debugging, which directs output to a file. Would this be what you want?

    export KF_TRACK_VIEWS=1
    export KF_DEBUG=1
    rm logs/debug.txt
    /usr/local/bin/Konfabulator --1080 >& logs/debug.txt
    0
  • Oops to clarify - I should say I do this only when *not* using the integrated debugger, but when I am debugging via log messages.
    0
  • Use -g <your widget ID> to limit the logging to just your widget. I have been working on a GUI tool too (written in Adobe AIR) which hopefully will be released relatively soon which will make this even easier. I'll keep you posted as we get closer to it's release.

    -Jeremy
    0
  • QUOTE (Jeremy Johnstone @ Jun 29 2009, 06:05 PM) <{POST_SNAPBACK}>
    Use -g <your widget ID> to limit the logging to just your widget.
    -Jeremy

    Some details, Jeremy? Thanks.
    0
  • It works like this.

    this will give you the list of widgets active and their reference ID
    CODE
    /widgets


    Terminal Exmaple
    CODE
    WD 00:00:37:309: [T:5484] Widgets:
    WD 00:00:37:309: [T:5484] * [0] Bootstrap (0x8aee140) (com.yahoo.widgets.tv.bootstrap:/home/tvuser/TVWidgets/Konfabulator-Vizio/TV/default.widget) 180.834kB
    WD 00:00:37:309: [T:5484] [1] Main (0x8cef8c0) (com.yahoo.widgets.tv.container:/home/tvuser/TVWidgets/Konfabulator-Vizio/data/Widgets/Installed/com.yahoo.widgets.tv.container.widget) 1022.061kB
    WD 00:00:37:309: [T:5484] [2] Yahoo!® Widget Gallery (0x947ba88) (com.yahoo.widgets.tv.widgetgallery:/home/tvuser/TVWidgets/Konfabulator-Vizio/data/Widgets/Installed/com.yahoo.widgets.tv.widgetgallery.widget) 1.431MB
    WD 00:00:37:309: [T:5484] [3] Profile Widget (0x970b400) (com.yahoo.widgets.tv.settings:/home/tvuser/TVWidgets/Konfabulator-Vizio/data/Widgets/Installed/com.yahoo.widgets.tv.settings.widget) 1.301M


    to pull up a specific widget
    CODE
    /widgets <widget number>


    Lets pull Profile Widget
    CODE
    /widgets 3


    You can then call any functions, variables, and/or execute remote commands

    Remote commands exampe
    CODE
    /key play       //Play Button
    /key up //Up button


    You can see the full list of terminal commands on page 83
    0
  • QUOTE (WidgetRealm @ Oct 18 2010, 05:54 AM) <{POST_SNAPBACK}>
    It works like this.

    this will give you the list of widgets active and their reference ID
    CODE
    /widgets


    Terminal Exmaple
    CODE
    WD 00:00:37:309: [T:5484] Widgets:
    WD 00:00:37:309: [T:5484] * [0] Bootstrap (0x8aee140) (com.yahoo.widgets.tv.bootstrap:/home/tvuser/TVWidgets/Konfabulator-Vizio/TV/default.widget) 180.834kB
    WD 00:00:37:309: [T:5484] [1] Main (0x8cef8c0) (com.yahoo.widgets.tv.container:/home/tvuser/TVWidgets/Konfabulator-Vizio/data/Widgets/Installed/com.yahoo.widgets.tv.container.widget) 1022.061kB
    WD 00:00:37:309: [T:5484] [2] Yahoo!® Widget Gallery (0x947ba88) (com.yahoo.widgets.tv.widgetgallery:/home/tvuser/TVWidgets/Konfabulator-Vizio/data/Widgets/Installed/com.yahoo.widgets.tv.widgetgallery.widget) 1.431MB
    WD 00:00:37:309: [T:5484] [3] Profile Widget (0x970b400) (com.yahoo.widgets.tv.settings:/home/tvuser/TVWidgets/Konfabulator-Vizio/data/Widgets/Installed/com.yahoo.widgets.tv.settings.widget) 1.301M


    to pull up a specific widget
    CODE
    /widgets <widget number>


    Lets pull Profile Widget
    CODE
    /widgets 3


    You can then call any functions, variables, and/or execute remote commands

    Remote commands exampe
    CODE
    /key play       //Play Button
    /key up //Up button


    You can see the full list of terminal commands on page 83


    Hi friend, I want to debug the javascript file, such as print a varible and add a watch, how can I do that? Any idea?
    0
  • QUOTE (Hill Zhao @ Oct 18 2010, 06:41 PM) <{POST_SNAPBACK}>
    Hi friend, I want to debug the javascript file, such as print a varible and add a watch, how can I do that? Any idea?

    We have some information on debugging here.

    To be honest, I've had varying success setting breakpoints in the console using the wdk. We're looking into this and plan on addressing it in the future.

    Having said that, you can learn a lot by attaching to a widget in the console and inspecting the objects.

    - Ben
    0
  • QUOTE (WidgetRealm @ Oct 18 2010, 05:54 AM) <{POST_SNAPBACK}>
    It works like this.

    this will give you the list of widgets active and their reference ID
    CODE
    /widgets


    Terminal Exmaple
    CODE
    WD 00:00:37:309: [T:5484] Widgets:
    WD 00:00:37:309: [T:5484] * [0] Bootstrap (0x8aee140) (com.yahoo.widgets.tv.bootstrap:/home/tvuser/TVWidgets/Konfabulator-Vizio/TV/default.widget) 180.834kB
    WD 00:00:37:309: [T:5484] [1] Main (0x8cef8c0) (com.yahoo.widgets.tv.container:/home/tvuser/TVWidgets/Konfabulator-Vizio/data/Widgets/Installed/com.yahoo.widgets.tv.container.widget) 1022.061kB
    WD 00:00:37:309: [T:5484] [2] Yahoo!® Widget Gallery (0x947ba88) (com.yahoo.widgets.tv.widgetgallery:/home/tvuser/TVWidgets/Konfabulator-Vizio/data/Widgets/Installed/com.yahoo.widgets.tv.widgetgallery.widget) 1.431MB
    WD 00:00:37:309: [T:5484] [3] Profile Widget (0x970b400) (com.yahoo.widgets.tv.settings:/home/tvuser/TVWidgets/Konfabulator-Vizio/data/Widgets/Installed/com.yahoo.widgets.tv.settings.widget) 1.301M


    to pull up a specific widget
    CODE
    /widgets <widget number>


    Lets pull Profile Widget
    CODE
    /widgets 3


    You can then call any functions, variables, and/or execute remote commands

    Remote commands exampe
    CODE
    /key play       //Play Button
    /key up //Up button


    You can see the full list of terminal commands on page 83


    page 83? Which tutorial? thanks.
    0
  • Not in the tutorial - in the WDK Developer Guide PDF.
    0
  • QUOTE (Hill Zhao @ Oct 18 2010, 12:13 AM) <{POST_SNAPBACK}>
    Some details, Jeremy? Thanks.

    You can also restrict logs to a specific widget in the simulator settings like this:

    CODE
    # In order to limit the console output to messages relevant to a particular widget 
    # please enter the widget ID below
    # example: restrict_console=com.yahoo.widgets.tv.finance
    restrict_console=com.yahoo.widgets.tv.test

    If you're running the wdk you'll need to quit and restart it after setting this variable.

    - Ben
    0
  • QUOTE (Benjamin Toll @ Oct 18 2010, 11:46 AM) <{POST_SNAPBACK}>
    If you're running the wdk you'll need to quit and restart it after setting this variable.

    To quickly clarify, you will need to"quit", "reset", and then "update" the simulator to get the restricted console to work after changing the Simulator Settings file.

    Hope this helps.
    0
  • QUOTE (Benjamin Toll @ Oct 18 2010, 11:46 AM) <{POST_SNAPBACK}>
    You can also restrict logs to a specific widget in the simulator settings like this:

    CODE
    # In order to limit the console output to messages relevant to a particular widget 
    # please enter the widget ID below
    # example: restrict_console=com.yahoo.widgets.tv.finance
    restrict_console=com.yahoo.widgets.tv.test

    If you're running the wdk you'll need to quit and restart it after setting this variable.

    - Ben

    It works, thanks.
    0
  • Also, you can telnet to localhost port 8008 to also get a connection into the console if you want to interact with the console even when you have output redirected to a file (can also use the unix utility "tee" as well).
    0
  • Cheers guys, very helpful info :)
    0
  • At the moment I have a widget that runs fine in the emulator, but has some problems on our samsung tv. How do I get the logging-output on that samsung?

    How do you debug those problems?
    0
  • QUOTE (putpat@... @ Jul 22 2009, 01:20 AM) <{POST_SNAPBACK}>
    At the moment I have a widget that runs fine in the emulator, but has some problems on our samsung tv. How do I get the logging-output on that samsung?

    How do you debug those problems?


    Okay, my solution was this:
    CODE
            var u = new URL();
    u.location = "http://MYIP/debug?output="+encode(msg);
    u.fetch();


    That way I could log to a server and watch the log there.
    0
  • QUOTE (putpat@... @ Jul 22 2009, 04:40 AM) <{POST_SNAPBACK}>
    Okay, my solution was this:
    CODE
            var u = new URL();
    u.location = "http://MYIP/debug?output="+encode(msg);
    u.fetch();


    That way I could log to a server and watch the log there.


    That is one alternative solution. If you wrap all of your code in a massive try / catch block you can catch JS errors too that way.

    -Jeremy
    0
  • QUOTE (putpat@... @ Jul 22 2009, 01:20 AM) <{POST_SNAPBACK}>
    At the moment I have a widget that runs fine in the emulator, but has some problems on our samsung tv. How do I get the logging-output on that samsung?

    How do you debug those problems?


    I have access to prototype non-production TVs for testing. Submit the widget to the gallery and provide me the widget ID / version # and I will test it and send back logs to you. Emailing tvwidgets@yahoo-inc.com is the best method and ask for it to be assigned to me.

    -Jeremy
    0
  • For non-ubuntu gurus like me...

    How can i export KF_LANG environment variable ?

    I have to edit a file or type any comand ?

    Thanks a lot.

    Raul de frutos
    ------------------
    0
  • QUOTE (Raul @ Oct 18 2010, 11:20 PM) <{POST_SNAPBACK}>
    For non-ubuntu gurus like me...

    How can i export KF_LANG environment variable ?

    I have to edit a file or type any comand ?

    Thanks a lot.

    Raul de frutos
    ------------------

    Raul,
    Please post a new topic when off-topic.

    To quickly answer your question, you can set it through the menu by going to Applications -> TV Widgets -> [your simulator] -> Simulator TV API Settings and then change the MenuLanguage property (btw, this maps to ~/TVWidgets/Konfabulator-Vizio/TVSystemProperties.txt

    You can also export an environmental variable via the command line like this:
    CODE
    KF_LANG=it ./Konfabulator

    I recommend the first way.

    Quit and restart the simulator.

    - Ben
    0

Recent Posts

in General - Yahoo! TV Widgets