JavaScriptConsoleCallback.ConsoleMessage


class JavaScriptConsoleCallback.ConsoleMessage


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

Summary

Constants

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

Public constructors

ConsoleMessage(
    level: Int,
    message: String,
    source: String,
    line: Int,
    column: Int,
    trace: String?
)

Construct a new ConsoleMessage

Public functions

Int

Return the column number producing the message

Int

Return the log level.

Int

Return the line number producing the message

String

Return the message body

String

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

Constants

LEVEL_DEBUG

Added in 1.0.0-beta01
const val LEVEL_DEBUG = 2: Int

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

LEVEL_ERROR

Added in 1.0.0-beta01
const val LEVEL_ERROR = 8: Int

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

LEVEL_INFO

Added in 1.0.0-beta01
const val LEVEL_INFO = 4: Int

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

LEVEL_LOG

Added in 1.0.0-beta01
const val LEVEL_LOG = 1: Int

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

LEVEL_WARNING

Added in 1.0.0-beta01
const val LEVEL_WARNING = 16: Int

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

Public constructors

ConsoleMessage

Added in 1.0.0-beta01
ConsoleMessage(
    level: Int,
    message: String,
    source: String,
    line: Int,
    column: Int,
    trace: String?
)

Construct a new ConsoleMessage

Parameters
level: Int

the message (error/verbosity) level

message: String

the message body

source: String

the source file/expression where the message was generated

line: Int

line number of where the message was generated

column: Int

column number of where the message was generated

trace: String?

stack trace of where the message was generated, if available

Public functions

getColumn

Added in 1.0.0-beta01
fun getColumn(): Int

Return the column number producing the message

Returns
Int

the column number producing the message

getLevel

Added in 1.0.0-beta01
fun getLevel(): Int

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
Int

the log level

getLine

Added in 1.0.0-beta01
fun getLine(): Int

Return the line number producing the message

Returns
Int

the line number producing the message

getMessage

Added in 1.0.0-beta01
fun getMessage(): String

Return the message body

Returns
String

the message body

toString

fun toString(): String

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
String

a string representation of this console message