openharmony 鸿蒙 arkts-basic-components-web-ConsoleMessage

2026-08-25 浏览 (1)

Class (ConsoleMessage)

Implements the ConsoleMessage object. For details about the sample code, see onConsole.

NOTE

  • The initial APIs of this component are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.

  • The initial APIs of this class are supported since API version 8.

  • The sample effect is subject to the actual device.

constructor(deprecated)

constructor(message: string, sourceId: string, lineNumber: number, messageLevel: MessageLevel)

Constructs a ConsoleMessage object.

NOTE

This API is supported since API version 8 and deprecated since API version 9. You are advised to use constructor instead.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
messagestringYesLog output information of ConsoleMessage.
sourceIdstringYesPath and name of the web page source file.
lineNumbernumberYesLine number of ConsoleMessage.
messageLevelMessageLevelYesLog level of ConsoleMessage.

constructor9+

constructor()

Constructs a ConsoleMessage object.

System capability: SystemCapability.Web.Webview.Core

getLineNumber

getLineNumber(): number

Obtains the number of rows in this console message.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
numberNumber of rows in the console message.

getMessage

getMessage(): string

Obtains the log information of this console message.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
stringLog information of the console message.

getMessageLevel

getMessageLevel(): MessageLevel

Obtains the level of this console message.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
MessageLevelLevel of the console message.

getSourceId

getSourceId(): string

Obtains the path and name of the web page source file.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
stringPath and name of the web page source file.

getSource23+

getSource(): ConsoleMessageSource

Obtains the log source of this console message.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
ConsoleMessageSourceLog source of the console message.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 arkts-apis-webview-WebviewController

openharmony 鸿蒙 arkts-apis-webview-t

openharmony 鸿蒙 arkts-apis-webview

openharmony 鸿蒙 capi-arkweb-type-h

openharmony 鸿蒙 arkts-basic-components-web-FullScreenExitHandler

openharmony 鸿蒙 arkts-apis-webview-WebDownloadManager

openharmony 鸿蒙 arkts-basic-components-web-VerifyPinHandler

openharmony 鸿蒙 capi-web-arkweb-webmessage8h

openharmony 鸿蒙 arkts-apis-webview-NativeMediaPlayerHandler

openharmony 鸿蒙 capi-web-arkweb-proxymethodwithresult

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/i3xmf8JB