API / Core / Console

Console

assert_

RESCRIPT
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

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

assert2

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

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

Examples

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

assert3

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

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

Examples

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

assert4

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

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

Examples

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

assert5

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

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

Examples

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

assert6

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

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

Examples

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

assertMany

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

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

Examples

RESCRIPT
Console.assertMany(false, ["Hello", "World"]) Console.assertMany(n == 42, [1, 2, 3])

clear

RESCRIPT
let clear: unit => unit

clear() clears the console, if allowed.

See console.clear on MDN.

Examples

RESCRIPT
Console.clear()

count

RESCRIPT
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

RESCRIPT
Console.count("rescript")

countReset

RESCRIPT
let countReset: string => unit

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

See console.countReset on MDN.

Examples

RESCRIPT
Console.countReset("rescript")

debug

RESCRIPT
let debug: 'a => unit

debug(value) print a debug message to console.

See console.debug on MDN.

Examples

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

debug2

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

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

Examples

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

debug3

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

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

Examples

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

debug4

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

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

Examples

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

debug5

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

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

Examples

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

debug6

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

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

Examples

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

debugMany

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

debugMany(arr). Like debug, but variadic.

Examples

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

dir

RESCRIPT
let dir: 'a => unit

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

See console.dir on MDN.

Examples

RESCRIPT
Console.dir({"language": "rescript", "version": 10.1.2})

dirxml

RESCRIPT
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

RESCRIPT
let error: 'a => unit

error(value) prints an error message to console.

See console.error on MDN.

Examples

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

error2

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

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

Examples

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

error3

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

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

Examples

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

error4

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

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

Examples

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

error5

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

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

Examples

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

error6

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

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

Examples

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

group

RESCRIPT
let group: string => unit

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

See console.group on MDN.

Example

RESCRIPT
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

RESCRIPT
let groupCollapsed: string => unit

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

See console.groupCollapsed on MDN.

groupEnd

RESCRIPT
let groupEnd: unit => unit

groupEnd() ends the current group.

See console.groupEnd on MDN.

errorMany

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

errorMany(arr). Like error, but variadic.

Examples

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

info

RESCRIPT
let info: 'a => unit

info(value) print an informational message to console.

See console.info on MDN.

Examples

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

info2

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

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

Examples

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

info3

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

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

Examples

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

info4

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

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

Examples

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

info5

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

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

Examples

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

info6

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

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

Examples

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

infoMany

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

infoMany(arr). Like info, but variadic.

Examples

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

log

RESCRIPT
let log: 'a => unit

log(value) print a message to console.

See console.log on MDN.

Examples

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

log2

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

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

Examples

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

log3

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

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

Examples

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

log4

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

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

Examples

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

log5

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

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

Examples

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

log6

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

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

Examples

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

logMany

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

logMany(arr). Like log, but variadic.

Examples

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

table

RESCRIPT
let table: 'a => unit

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

See console.table on MDN.

Examples

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

time

RESCRIPT
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

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

timeEnd

RESCRIPT
let timeEnd: string => unit

timeEnd(label) stops a timer created by time.

See console.timeEnd on MDN.

Examples

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

timeLog

RESCRIPT
let timeLog: string => unit

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

See console.timeLog on MDN.

Examples

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

trace

RESCRIPT
let trace: unit => unit

trace() print a stack trace to console.

See console.trace on MDN.

Examples

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

warn

RESCRIPT
let warn: 'a => unit

warn(value) print a warning message to console.

See console.warn on MDN.

Examples

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

warn2

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

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

Examples

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

warn3

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

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

Examples

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

warn4

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

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

Examples

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

warn5

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

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

Examples

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

warn6

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

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

Examples

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

warnMany

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

warnMany(arr). Like warn, but variadic.

Examples

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