Console Logs

Module to Import

No module is required.

Permission List

None

Log Category

Prints a log using console.debug|log|info|warn|error(message).

  • Parameter

    Name

    Type

    Mandatory

    Description

    message

    string

    Yes

    Text to print

  • Example

    var versionCode = 1;
    console.info('Hello World. The current version code is ' + versionCode);
    

    Switch to the HiLog window at the bottom of HUAWEI DevEco Studio. Specifically, select the current device and process, set the log level to Info, and enter Hello World in the search box. Logs that meet the search criteria are displayed, as shown in the following figure.

    NOTE: The console.log() function prints logs at the debug level.