共用方式為


WinJS.Utilities.startLog function

Configures a logger that writes messages containing the specified tags to the JavaScript console.

Syntax

WinJS.Utilities.startLog(options);

Parameters

  • options
    Type: Object

    The tags for messages to log. Multiple tags should be separated by spaces.

    May contain type, tags, excludeTags and action properties.

    • type is required.

    • excludeTags is a space-separated list of tags, any of which will result in a message not being logged.

    • tags is a space-separated list of tags, any of which will result in a message being logged.

    • action is a function that, if present, is called with the following parameters:

      • message: String. The message to log.

      • tags: String. The tag or tags to categorize the message.

      • type: String. The type of message (error, warning, info, etc.).

      The default action writes the message to the JavaScript console.

Return value

This function does not return a value.

Remarks

You can use Windows Library for JavaScript logging to help troubleshoot specific issues. It is best to start logging when the app is being initialized. The following example shows how to start logging.

WinJS.Utilities.startLog({ type: "error", tags: "winjs controls" });

You can specify the following types:

  • error: The message is about an error condition.

  • warn: The message is a warning.

  • info: The message is for informational purposes.

  • perf: The message is related to performance.

You can specify the following tags:

  • winjs: The message is about WinJS.

  • winjs controls: The message is about WinJS controls.

  • winjs binding: The message is about WinJS binding.

  • winjs viewPortPageRealized: The message is about displaying pages in a ListView.

  • winjs pageRealized: The message is about displaying pages in a ListView.

Requirements

Minimum WinJS version

WinJS 1.0

Namespace

WinJS.Utilities