public final class

JavaScriptConsoleCallback.ConsoleMessage

extends java.lang.Object

 java.lang.Object

↳androidx.javascriptengine.JavaScriptConsoleCallback.ConsoleMessage

Overview

Representation of a console message, such as produced by console.log.

Summary

Fields
public static final intLEVEL_DEBUG

Level for debug-level messages, usually generated through console.debug() or console.count().

public static final intLEVEL_ERROR

Level for error-level messages, usually generated through console.error() or console.assert().

public static final intLEVEL_INFO

Level for info-level messages, usually generated through console.info() or console.trace().

public static final intLEVEL_LOG

Level for log-level messages, usually generated through console.log().

public static final intLEVEL_WARNING

Level for warning-level messages, usually generated through console.warn().

Constructors
publicConsoleMessage(int level, java.lang.String message, java.lang.String source, int line, int column, java.lang.String trace)

Construct a new ConsoleMessage

Methods
public intgetColumn()

Return the column number producing the message

public intgetLevel()

Return the log level.

public intgetLine()

Return the line number producing the message

public java.lang.StringgetMessage()

Return the message body

public java.lang.StringgetSource()

Return the source file/expression name

public java.lang.StringgetTrace()

Return a stringified stack trace.

public java.lang.StringtoString()

Return a string representation of this console message, including the message body and where it came from.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Fields

public static final int LEVEL_LOG

Level for log-level messages, usually generated through console.log().

public static final int LEVEL_DEBUG

Level for debug-level messages, usually generated through console.debug() or console.count().

public static final int LEVEL_INFO

Level for info-level messages, usually generated through console.info() or console.trace().

public static final int LEVEL_ERROR

Level for error-level messages, usually generated through console.error() or console.assert().

public static final int LEVEL_WARNING

Level for warning-level messages, usually generated through console.warn().

Constructors

public ConsoleMessage(int level, java.lang.String message, java.lang.String source, int line, int column, java.lang.String trace)

Construct a new ConsoleMessage

Parameters:

level: the message (error/verbosity) level
message: the message body
source: the source file/expression where the message was generated
line: line number of where the message was generated
column: column number of where the message was generated
trace: stack trace of where the message was generated, if available

Methods

public int getLevel()

Return the log level.

ConsoleMessages can be filtered by level using a bitmask of the desired levels. However, any ConsoleMessage will only have one level associated with it.

Returns:

the log level

public java.lang.String getMessage()

Return the message body

Returns:

the message body

public java.lang.String getSource()

Return the source file/expression name

Returns:

the source file/expression name

public int getLine()

Return the line number producing the message

Returns:

the line number producing the message

public int getColumn()

Return the column number producing the message

Returns:

the column number producing the message

public java.lang.String getTrace()

Return a stringified stack trace.

A stack trace is not guaranteed to be available, and this method may return null. Console messages may originate from outside of an evaluation (where a stack trace would not make sense), or may be omitted for performance reasons. A stack trace is not guaranteed to be complete if present. The precise formatting of the trace is not defined.

Returns:

a stringified stack trace

public java.lang.String toString()

Return a string representation of this console message, including the message body and where it came from.

Do not try to parse the result of this method as its format may change across JavaScriptEngine versions.

Returns:

a string representation of this console message