Harmony basic HiLog output log method (HarmonyOS Harmony OS development basic knowledge)

What is HiLog

Provides methods for outputting HiLog logs.
Before outputting the log, you must define the log type, service domain and mark in HiLogLabel, use the interface specific to the specified log level, and specify the privacy identifier.

Log level: debug, information, warning, error and fatal.
Parameter format: printf format string, starting with the% character, including parameter type identifiers and variable parameters.
Privacy identifier: {public} or {private} is added between the% character in each parameter and the parameter type identifier.

Sample code:

static final HiLogLabel label = new HiLogLabel(HiLog.LOG_APP, MY_MODULE, "MY_TAG"); //MY_MODULE=0x00201

HiLog.warn(label, "Failed to visit %{private}s, reason:%{public}d.", url, errno);
 

Log level

Screenshot 2020-09-22 1.56.54.png in the afternoon

Common functions

Screenshot 2020-09-22 1.58.11.png in the afternoon


Unauthorized reprinting is prohibited


For more technical exchanges, please join the QQ group

Group name: harmonyos Hongmeng Technology Exchange
Group number: 856567895


Start from scratch to learn HarmonyOS Hongmeng 2.0 development

Guess you like

Origin blog.csdn.net/iCloudEnd/article/details/108730968