If you want to view the JavaScript console, simply go to
DEBUG > Windows > JavaScript Console
in the Visual Studio menus. From there, you can utilize the traditional
console.log()
method to write to it. Alternatively, you can use the various
WinJS
functions available:
For instance, there is WinJS.log()
which allows you to log something after setting up the function with WinJS.Utilities.startLog()
:
WinJS.Utilities.startLog({type: "info", tags: "custom" });
WinJS.log("my message", "info", "custom");
Here are key details about the WinJS
logging functions:
startLog(options)
: Establishes a logger for writing messages containing specified tags to the JavaScript console.
The options
object needs to include a type
, which should be one of error
, warn
, info
, or perf
. Additionally, if you want only specific logs captured, also incorporate tags
into the object with a space-separated list of desired tags to log.
WinJS.log(message, tags, type)
: Although this function does not come pre-built, it gets generated through your startLog()
setup. While you could manually create it as well, utilizing startLog()
for console logging is recommended.