3.17Logging

A widget can record its activity in several ways. Pick based on the audience for the message.

User-facing status — short, transient updates the user should notice. Use toast. Framework.Log() is available as an alias for Framework.CreateToast(); its name is reserved for a richer logging API in the future, so widgets that want to future-proof themselves can use Framework.Log() today in the expectation that its behaviour may grow over time.

Ongoing activity the user will want to review. Implement a list of messages in the widget's own HTML. This is the right choice whenever the information is worth scrolling back through, rather than glancing at once and dismissing. For trading algos in particular, an in-widget activity log is often the right pattern: it complements the algo's control panel (parameters, Start/Stop buttons) with a running record of decisions and trades, all visible in one place. See the canonical widget skeleton in §1.1.1.

Developer diagnostics — debug output meant for you, not the user. Use the browser's standard console.log, console.warn, and console.error. These appear in the browser's Developer Console and are invisible to end users, which is exactly what you want for debug output. Do not use toast for this — it spams the user with information meant for you.

Note: the MyTrader platform does not currently have a centralised log or console of its own. This may change.