Console

Functions for interacting with JavaScript console.

See: console.

assert_

RES
let assert_: (bool, 'a) => unit

assert_(assertion, value) print a message to console if assertion evaluates false. Does nothing if it's true.

See console.assert on MDN.

Examples

RES
Console.assert_(false, "Hello World!") Console.assert_(42 === 42, "The answer")

assert2

RES
let assert2: (bool, 'a, 'b) => unit

assert2(v1, v2). Like assert_, but with two arguments.

Examples

RES
Console.assert2(false, "Hello", "World") Console.assert2(42 === 42, [1, 2, 3], '4')

assert3

RES
let assert3: (bool, 'a, 'b, 'c) => unit

assert3(v1, v2, v3). Like assert_, but with three arguments.

Examples

RES
Console.assert3(false, "Hello", "World", "ReScript") Console.assert3(42 === 42, "One", 2, #3)

assert4

RES
let assert4: (bool, 'a, 'b, 'c, 'd) => unit

assert4(v1, v2, v3, v4). Like assert_, but with four arguments.

Examples

RES
let value = 42 Console.assert4(false, "Hello", "World", "ReScript", "!!!") Console.assert4(value === 42, [1, 2], (3, 4), [#5, #6], #polyvar)

assert5

RES
let assert5: (bool, 'a, 'b, 'c, 'd, 'e) => unit

assert5(v1, v2, v3, v4, v5). Like assert_, but with five arguments.

Examples

RES
let value = 42 Console.assert5(false, "Hello", "World", "JS", '!', '!') Console.assert5(value === 42, [1, 2], (3, 4), [#5, #6], #polyvar, {"name": "ReScript"})

assert6

RES
let assert6: (bool, 'a, 'b, 'c, 'd, 'e, 'f) => unit

assert6(v1, v2). Like assert_, but with six arguments.

Examples

RES
let value = 42 Console.assert6(false, "Hello", "World", "JS", '!', '!', '?') Console.assert6(value === 42, [1, 2], (3, 4), [#5, #6], #polyvar, {"name": "ReScript"}, 42)

assertMany

RES
let assertMany: (bool, array<'a>) => unit

assertMany(assertion, arr). Like assert_, but variadic.

Examples

RES
let value = 42 Console.assertMany(false, ["Hello", "World"]) Console.assertMany(value === 42, [1, 2, 3])

clear

RES
let clear: unit => unit

clear() clears the console, if allowed.

See console.clear on MDN.

Examples

RES
Console.clear()

count

RES
let count: string => unit

count(label) prints to the console the number of times it's been called with the given label.

See console.count on MDN.

Examples

RES
Console.count("rescript")

countReset

RES
let countReset: string => unit

countReset(label) resets the count for the given label to 0.

See console.countReset on MDN.

Examples

RES
Console.countReset("rescript")

debug

RES
let debug: 'a => unit

debug(value) print a debug message to console.

See console.debug on MDN.

Examples

RES
Console.debug("Hello") let obj = {"name": "ReScript", "version": 10} Console.debug(obj)

debug2

RES
let debug2: ('a, 'b) => unit

debug2(v1, v2). Like debug, but with two arguments.

Examples

RES
Console.debug2("Hello", "World") Console.debug2([1, 2, 3], '4')

debug3

RES
let debug3: ('a, 'b, 'c) => unit

debug3(v1, v2, v3). Like debug, but with three arguments.

Examples

RES
Console.debug3("Hello", "World", "ReScript") Console.debug3("One", 2, #3)

debug4

RES
let debug4: ('a, 'b, 'c, 'd) => unit

debug4(v1, v2, v3, v4). Like debug, but with four arguments.

Examples

RES
Console.debug4("Hello", "World", "ReScript", "!!!") Console.debug4([1, 2], (3, 4), [#5, #6], #polyvar)

debug5

RES
let debug5: ('a, 'b, 'c, 'd, 'e) => unit

debug5(v1, v2, v3, v4, v5). Like debug, but with five arguments.

Examples

RES
Console.debug5("Hello", "World", "JS", '!', '!') Console.debug5([1, 2], (3, 4), [#5, #6], #polyvar, {"name": "ReScript"})

debug6

RES
let debug6: ('a, 'b, 'c, 'd, 'e, 'f) => unit

debug6(v1, v2, v3, v4, v5, v6). Like debug, but with six arguments.

Examples

RES
Console.debug6("Hello", "World", "JS", '!', '!', '?') Console.debug6([1, 2], (3, 4), [#5, #6], #polyvar, {"name": "ReScript"}, 42)

debugMany

RES
let debugMany: array<'a> => unit

debugMany(arr). Like debug, but variadic.

Examples

RES
Console.debugMany(["Hello", "World"]) Console.debugMany([1, 2, 3])

dir

RES
let dir: ('a, ~options: dirOptions=?) => unit

dir(object, options) displays an interactive view of the object in the console.

See console.dir on MDN.

Examples

RES
Console.dir({"language": "rescript", "version": "10.1.2"}) Console.dir( {"language": "rescript", "version": {"major": "10", "minor": "1", "patch": "2"}}, ~options={depth: null}, )

dirOptions

RES
type dirOptions = { colors?: bool, depth?: Nullable.t<int>, showHidden?: bool, }

dirxml

RES
let dirxml: 'a => unit

dirxml(object) displays an interactive tree view of an XML/HTML element in the console.

See console.dirxml on MDN.

error

RES
let error: 'a => unit

error(value) prints an error message to console.

See console.error on MDN.

Examples

RES
Console.error("error message") Console.error(("error", "invalid value"))

error2

RES
let error2: ('a, 'b) => unit

error(v1, v2). Like error, but two arguments.

Examples

RES
Console.error2("Error", "here") Console.error2(("log", "error"), "message")

error3

RES
let error3: ('a, 'b, 'c) => unit

error3(v1, v2, v3). Like error, but three arguments.

Examples

RES
Console.error3("Hello", "World", "!!!") Console.error3(#first, #second, #third)

error4

RES
let error4: ('a, 'b, 'c, 'd) => unit

error4(v1, v2, v3, v4). Like error, but with four arguments.

Examples

RES
Console.error4("Hello", "World", "ReScript", '!') Console.error4(#first, #second, #third, "fourth")

error5

RES
let error5: ('a, 'b, 'c, 'd, 'e) => unit

error5(v1, v2, v3, v4, v5). Like error, but with five arguments.

Examples

RES
Console.error5('e', 'r', 'r', 'o', 'r') Console.error5(1, #second, #third, "fourth", 'c')

error6

RES
let error6: ('a, 'b, 'c, 'd, 'e, 'f) => unit

error6(v1, v2, v3, v4, v5, v6). Like error, but with six arguments.

Examples

RES
Console.error6("Hello", "World", "from", "JS", "!!!", '!') Console.error6([1, 2], (3, 4), [#5, #6], #polyvar, {"name": "ReScript"}, 42)

errorMany

RES
let errorMany: array<'a> => unit

errorMany(arr). Like error, but variadic.

Examples

RES
Console.errorMany(["Hello", "World"]) Console.errorMany([1, 2, 3])

group

RES
let group: string => unit

group(label) creates a new "group" level with the given label.

See console.group on MDN.

Example

RES
Console.group("first group") Console.group("second group") Console.log("a message on the second level") Console.groupEnd() Console.log("a message message on the first level") Console.groupEnd()

groupCollapsed

RES
let groupCollapsed: string => unit

groupCollapsed(label). Like group but collapses the group initially.

See console.groupCollapsed on MDN.

groupEnd

RES
let groupEnd: unit => unit

groupEnd() ends the current group.

See console.groupEnd on MDN.

info

RES
let info: 'a => unit

info(value) print an informational message to console.

See console.info on MDN.

Examples

RES
Console.info("Information") Console.info(("Hello", "JS"))

info2

RES
let info2: ('a, 'b) => unit

info2(v1, v2). Like info, but with two arguments.

Examples

RES
Console.info2("Info", "failed to download") Console.info2(#info, {"name": "ReScript"})

info3

RES
let info3: ('a, 'b, 'c) => unit

info3(v1, v2, v3). Like info, but with three arguments.

Examples

RES
Console.info3("Hello", "World", "ReScript") Console.info3([1, 2, 3], #4, #5)

info4

RES
let info4: ('a, 'b, 'c, 'd) => unit

info4(v1, v2, v3, v4). Like info, but with four arguments.

Examples

RES
Console.info4("Hello", "World", "ReScript", '!') Console.info4([1, 2, 3], #4, #5, #lastinfo)

info5

RES
let info5: ('a, 'b, 'c, 'd, 'e) => unit

info5(v1, v2, v3, v4, v5). Like info, but with five arguments.

Examples

RES
Console.info5("Hello", "World", "from", "JS", "!!!") Console.info5([1, 2], (3, 4), [#5, #6], #polyvar, {"name": "ReScript"})

info6

RES
let info6: ('a, 'b, 'c, 'd, 'e, 'f) => unit

info6(v1, v2, v3, v4, v5, v6). Like info, but with six arguments.

Examples

RES
Console.info6("Hello", "World", "from", "JS", "!!!", '!') Console.info6([1, 2], (3, 4), [#5, #6], #polyvar, {"name": "ReScript"}, 42)

infoMany

RES
let infoMany: array<'a> => unit

infoMany(arr). Like info, but variadic.

Examples

RES
Console.infoMany(["Hello", "World"]) Console.infoMany([1, 2, 3])

log

RES
let log: 'a => unit

log(value) print a message to console.

See console.log on MDN.

Examples

RES
Console.log("Hello") let obj = {"name": "ReScript", "version": 10} Console.log(obj)

log2

RES
let log2: ('a, 'b) => unit

log2(v1, v2). Like log, but with two arguments.

Examples

RES
Console.log2("Hello", "World") Console.log2([1, 2, 3], '4')

log3

RES
let log3: ('a, 'b, 'c) => unit

log3(v1, v2, v3). Like log, but with three arguments.

Examples

RES
Console.log3("Hello", "World", "ReScript") Console.log3("One", 2, #3)

log4

RES
let log4: ('a, 'b, 'c, 'd) => unit

log4(v1, v2, v3, v4). Like log, but with four arguments.

Examples

RES
Console.log4("Hello", "World", "ReScript", "!!!") Console.log4([1, 2], (3, 4), [#5, #6], #polyvar)

log5

RES
let log5: ('a, 'b, 'c, 'd, 'e) => unit

log5(v1, v2, v3, v4, v5). Like log, but with five arguments.

Examples

RES
Console.log5("Hello", "World", "JS", '!', '!') Console.log5([1, 2], (3, 4), [#5, #6], #polyvar, {"name": "ReScript"})

log6

RES
let log6: ('a, 'b, 'c, 'd, 'e, 'f) => unit

log6(v1, v2, v3, v4, v5, v6). Like log, but with six arguments.

Examples

RES
Console.log6("Hello", "World", "JS", '!', '!', '?') Console.log6([1, 2], (3, 4), [#5, #6], #polyvar, {"name": "ReScript"}, 42)

logMany

RES
let logMany: array<'a> => unit

logMany(arr). Like log, but variadic.

Examples

RES
Console.logMany(["Hello", "World"]) Console.logMany([1, 2, 3])

table

RES
let table: 'a => unit

table(object) displays an tabular view of the object in the console.

See console.table on MDN.

Examples

RES
Console.table({"language": "rescript", "version": "10.1.2"})

time

RES
let time: string => unit

time(label) creates a timer to measure how long an operation takes. label must be a unique name. Call console.timeEnd with the same label to print output time.

See console.time on MDN.

Examples

RES
Console.time("for_time") for x in 3 downto 1 { Console.log(x) Console.timeLog("for_time") } Console.timeEnd("for_time")

timeEnd

RES
let timeEnd: string => unit

timeEnd(label) stops a timer created by time.

See console.timeEnd on MDN.

Examples

RES
Console.time("for_time") for x in 3 downto 1 { Console.log(x) Console.timeLog("for_time") } Console.timeEnd("for_time")

timeLog

RES
let timeLog: string => unit

timeLog(label) prints the current elapsed time of the given timer to the console.

See console.timeLog on MDN.

Examples

RES
Console.time("for_time") for x in 3 downto 1 { Console.log(x) Console.timeLog("for_time") } Console.timeEnd("for_time")

trace

RES
let trace: unit => unit

trace() print a stack trace to console.

See console.trace on MDN.

Examples

RES
let main = () => { Console.trace() } main() // In the console, the following trace will be displayed: // main // <anonymous>

warn

RES
let warn: 'a => unit

warn(value) print a warning message to console.

See console.warn on MDN.

Examples

RES
Console.warn("Warning") Console.warn(("Warning", "invalid number"))

warn2

RES
let warn2: ('a, 'b) => unit

warn2(v1, v2). Like warn, but two arguments.

Examples

RES
Console.warn2("Hello", "World") Console.warn2([1, 2, 3], 4)

warn3

RES
let warn3: ('a, 'b, 'c) => unit

warn3(v1, v2, v3). Like warn, but three arguments.

Examples

RES
Console.warn3("Hello", "World", "ReScript") Console.warn3([1, 2, 3], #4, #5)

warn4

RES
let warn4: ('a, 'b, 'c, 'd) => unit

warn4(v1, v2, v3, v4). Like warn, but with four arguments.

Examples

RES
Console.warn4("Hello", "World", "ReScript", "!!!") Console.warn4(#first, #second, #third, "fourth")

warn5

RES
let warn5: ('a, 'b, 'c, 'd, 'e) => unit

warn5(v1, v2, v3, v4, v5). Like warn, but with five arguments.

Examples

RES
Console.warn5("Hello", "World", "from", "JS", "!!!") Console.warn5([1, 2], (3, 4), [#5, #6], #polyvar, {"name": "ReScript"})

warn6

RES
let warn6: ('a, 'b, 'c, 'd, 'e, 'f) => unit

warn6(v1, v2, v3, v4, v5, v6). Like warn, but with six arguments.

Examples

RES
Console.warn6("Hello", "World", "from", "JS", "!!!", '!') Console.warn6([1, 2], (3, 4), [#5, #6], #polyvar, {"name": "ReScript"}, 42)

warnMany

RES
let warnMany: array<'a> => unit

warnMany(arr). Like warn, but variadic.

Examples

RES
Console.warnMany(["Hello", "World"]) Console.warnMany([1, 2, 3])