Console
assert_
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
RESCRIPTConsole.assert_(false, "Hello World!")
Console.assert_(n == 42, "The answer")
assert2
let assert2: (bool, 'a, 'b) => unit
assert2(v1, v2)
. Like assert_
, but with two arguments.
Examples
RESCRIPTConsole.assert2(false, "Hello", "World")
Console.assert2(n == 42, [1, 2, 3], '4')
assert3
let assert3: (bool, 'a, 'b, 'c) => unit
assert3(v1, v2, v3)
. Like assert_
, but with three arguments.
Examples
RESCRIPTConsole.assert3(false, "Hello", "World", "ReScript")
Console.assert3(n == 42, "One", 2, #3)
assert4
let assert4: (bool, 'a, 'b, 'c, 'd) => unit
assert4(v1, v2, v3, v4)
. Like assert_
, but with four arguments.
Examples
RESCRIPTConsole.assert4(false, "Hello", "World", "ReScript", "!!!")
Console.assert4(m == 42, [1, 2], (3, 4), [#5, #6], #"polyvar")
assert5
let assert5: (bool, 'a, 'b, 'c, 'd, 'e) => unit
assert5(v1, v2, v3, v4, v5)
. Like assert_
, but with five arguments.
Examples
RESCRIPTConsole.assert5(false, "Hello", "World", "JS", '!', '!')
Console.assert5(n == 42, [1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"})
assert6
let assert6: (bool, 'a, 'b, 'c, 'd, 'e, 'f) => unit
assert6(v1, v2)
. Like assert_
, but with six arguments.
Examples
RESCRIPTConsole.assert6(false, "Hello", "World", "JS", '!', '!', '?')
Console.assert6(n == 42, [1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42)
assertMany
let assertMany: (bool, array<'a>) => unit
assertMany(assertion, arr)
. Like assert_
, but variadic.
Examples
RESCRIPTConsole.assertMany(false, ["Hello", "World"])
Console.assertMany(n == 42, [1, 2, 3])
clear
let clear: unit => unit
count
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
RESCRIPTConsole.count("rescript")
countReset
let countReset: string => unit
countReset(label)
resets the count for the given label to 0.
See console.countReset
on MDN.
Examples
RESCRIPTConsole.countReset("rescript")
debug
let debug: 'a => unit
debug(value)
print a debug message to console.
See console.debug
on MDN.
Examples
RESCRIPTConsole.debug("Hello")
let obj = {"name": "ReScript", "version": 10}
Console.debug(obj)
debug2
let debug2: ('a, 'b) => unit
debug2(v1, v2)
. Like debug
, but with two arguments.
Examples
RESCRIPTConsole.debug2("Hello", "World")
Console.debug2([1, 2, 3], '4')
debug3
let debug3: ('a, 'b, 'c) => unit
debug3(v1, v2, v3)
. Like debug
, but with three arguments.
Examples
RESCRIPTConsole.debug3("Hello", "World", "ReScript")
Console.debug3("One", 2, #3)
debug4
let debug4: ('a, 'b, 'c, 'd) => unit
debug4(v1, v2, v3, v4)
. Like debug
, but with four arguments.
Examples
RESCRIPTConsole.debug4("Hello", "World", "ReScript", "!!!")
Console.debug4([1, 2], (3, 4), [#5, #6], #"polyvar")
debug5
let debug5: ('a, 'b, 'c, 'd, 'e) => unit
debug5(v1, v2, v3, v4, v5)
. Like debug
, but with five arguments.
Examples
RESCRIPTConsole.debug5("Hello", "World", "JS", '!', '!')
Console.debug5([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"})
debug6
let debug6: ('a, 'b, 'c, 'd, 'e, 'f) => unit
debug6(v1, v2, v3, v4, v5, v6)
. Like debug
, but with six arguments.
Examples
RESCRIPTConsole.debug6("Hello", "World", "JS", '!', '!', '?')
Console.debug6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42)
debugMany
let debugMany: array<'a> => unit
debugMany(arr)
. Like debug
, but variadic.
Examples
RESCRIPTConsole.debugMany(["Hello", "World"])
Console.debugMany([1, 2, 3])
dir
let dir: 'a => unit
dir(object)
displays an interactive view of the object in the console.
See console.dir
on MDN.
Examples
RESCRIPTConsole.dir({"language": "rescript", "version": 10.1.2})
dirxml
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
let error: 'a => unit
error(value)
prints an error message to console.
See console.error
on MDN.
Examples
RESCRIPTConsole.error("error message")
Console.error(("error", "invalid value"))
error2
let error2: ('a, 'b) => unit
error(v1, v2)
. Like error
, but two arguments.
Examples
RESCRIPTConsole.error2("Error", "here")
Console.error2(("log", "error"), "message")
error3
let error3: ('a, 'b, 'c) => unit
error3(v1, v2, v3)
. Like error
, but three arguments.
Examples
RESCRIPTConsole.error3("Hello", "World", "!!!")
Console.error3(#first, #second, #third)
error4
let error4: ('a, 'b, 'c, 'd) => unit
error4(v1, v2, v3, v4)
. Like error
, but with four arguments.
Examples
RESCRIPTConsole.error4("Hello", "World", "ReScript", '!')
Console.error4(#first, #second, #third, ("fourth"))
error5
let error5: ('a, 'b, 'c, 'd, 'e) => unit
error5(v1, v2, v3, v4, v5)
. Like error
, but with five arguments.
Examples
RESCRIPTConsole.error5('e', 'r, 'r', 'o', 'r')
Console.error5(1, #second, #third, ("fourth"), 'c')
error6
let error6: ('a, 'b, 'c, 'd, 'e, 'f) => unit
error6(v1, v2, v3, v4, v5, v6)
. Like error
, but with six arguments.
Examples
RESCRIPTConsole.error6("Hello", "World", "from", "JS", "!!!", '!')
Console.error6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42)
group
let group: string => unit
group(label)
creates a new "group" level with the given label.
See console.group
on MDN.
Example
RESCRIPTConsole.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
let groupCollapsed: string => unit
groupCollapsed(label)
. Like group
but collapses the group initially.
See console.groupCollapsed
on MDN.
groupEnd
let groupEnd: unit => unit
groupEnd()
ends the current group.
See console.groupEnd
on MDN.
errorMany
let errorMany: array<'a> => unit
errorMany(arr)
. Like error
, but variadic.
Examples
RESCRIPTConsole.errorMany(["Hello", "World"])
Console.errorMany([1, 2, 3])
info
let info: 'a => unit
info(value)
print an informational message to console.
See console.info
on MDN.
Examples
RESCRIPTConsole.info("Information")
Console.info(("Hello", "JS"))
info2
let info2: ('a, 'b) => unit
info2(v1, v2)
. Like info
, but with two arguments.
Examples
RESCRIPTConsole.info2("Info", "failed to download")
Console.info2(#info, {"name": "ReScript"})
info3
let info3: ('a, 'b, 'c) => unit
info3(v1, v2, v3)
. Like info
, but with three arguments.
Examples
RESCRIPTConsole.info3("Hello", "World", "ReScript")
Console.info3([1, 2, 3], #4, #5)
info4
let info4: ('a, 'b, 'c, 'd) => unit
info4(v1, v2, v3, v4)
. Like info
, but with four arguments.
Examples
RESCRIPTConsole.info4("Hello", "World", "ReScript", '!')
Console.info4([1, 2, 3], #4, #5, #lastinfo)
info5
let info5: ('a, 'b, 'c, 'd, 'e) => unit
info5(v1, v2, v3, v4, v5)
. Like info
, but with five arguments.
Examples
RESCRIPTConsole.info5("Hello", "World", "from", "JS", "!!!")
Console.info5([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"})
info6
let info6: ('a, 'b, 'c, 'd, 'e, 'f) => unit
info6(v1, v2, v3, v4, v5, v6)
. Like info
, but with six arguments.
Examples
RESCRIPTConsole.info6("Hello", "World", "from", "JS", "!!!", '!')
Console.info6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42)
infoMany
let infoMany: array<'a> => unit
infoMany(arr)
. Like info
, but variadic.
Examples
RESCRIPTConsole.infoMany(["Hello", "World"])
Console.infoMany([1, 2, 3])
log
let log: 'a => unit
log(value)
print a message to console.
See console.log
on MDN.
Examples
RESCRIPTConsole.log("Hello")
let obj = {"name": "ReScript", "version": 10}
Console.log(obj)
log2
let log2: ('a, 'b) => unit
log2(v1, v2)
. Like log
, but with two arguments.
Examples
RESCRIPTConsole.log2("Hello", "World")
Console.log2([1, 2, 3], '4')
log3
let log3: ('a, 'b, 'c) => unit
log3(v1, v2, v3)
. Like log
, but with three arguments.
Examples
RESCRIPTConsole.log3("Hello", "World", "ReScript")
Console.log3("One", 2, #3)
log4
let log4: ('a, 'b, 'c, 'd) => unit
log4(v1, v2, v3, v4)
. Like log
, but with four arguments.
Examples
RESCRIPTConsole.log4("Hello", "World", "ReScript", "!!!")
Console.log4([1, 2], (3, 4), [#5, #6], #"polyvar")
log5
let log5: ('a, 'b, 'c, 'd, 'e) => unit
log5(v1, v2, v3, v4, v5)
. Like log
, but with five arguments.
Examples
RESCRIPTConsole.log5("Hello", "World", "JS", '!', '!')
Console.log5([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"})
log6
let log6: ('a, 'b, 'c, 'd, 'e, 'f) => unit
log6(v1, v2, v3, v4, v5, v6)
. Like log
, but with six arguments.
Examples
RESCRIPTConsole.log6("Hello", "World", "JS", '!', '!', '?')
Console.log6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42)
logMany
let logMany: array<'a> => unit
logMany(arr)
. Like log
, but variadic.
Examples
RESCRIPTConsole.logMany(["Hello", "World"])
Console.logMany([1, 2, 3])
table
let table: 'a => unit
table(object)
displays an tabular view of the object in the console.
See console.table
on MDN.
Examples
RESCRIPTConsole.table({"language": "rescript", "version": 10.1.2})
time
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
RESCRIPTConsole.time("for_time")
for x in 3 downto 1 {
Console.log(x)
Console.timeLog("for_time")
}
Console.timeEnd("for_time")
timeEnd
let timeEnd: string => unit
timeEnd(label)
stops a timer created by time
.
See console.timeEnd
on MDN.
Examples
RESCRIPTConsole.time("for_time")
for x in 3 downto 1 {
Console.log(x)
Console.timeLog("for_time")
}
Console.timeEnd("for_time")
timeLog
let timeLog: string => unit
timeLog(label)
prints the current elapsed time of the given timer to the console.
See console.timeLog
on MDN.
Examples
RESCRIPTConsole.time("for_time")
for x in 3 downto 1 {
Console.log(x)
Console.timeLog("for_time")
}
Console.timeEnd("for_time")
trace
let trace: unit => unit
trace()
print a stack trace to console.
See console.trace
on MDN.
Examples
RESCRIPTlet main = () => {
Console.trace()
}
main()
// In the console, the following trace will be displayed:
// main
// <anonymous>
warn
let warn: 'a => unit
warn(value)
print a warning message to console.
See console.warn
on MDN.
Examples
RESCRIPTConsole.warn("Warning")
Console.warn(("Warning", "invalid number"))
warn2
let warn2: ('a, 'b) => unit
warn2(v1, v2)
. Like warn
, but two arguments.
Examples
RESCRIPTConsole.warn2("Hello", "World")
Console.warn2([1, 2, 3], 4)
warn3
let warn3: ('a, 'b, 'c) => unit
warn3(v1, v2, v3)
. Like warn
, but three arguments.
Examples
RESCRIPTConsole.warn3("Hello", "World", "ReScript")
Console.warn3([1, 2, 3], #4, #5)
warn4
let warn4: ('a, 'b, 'c, 'd) => unit
warn4(v1, v2, v3, v4)
. Like warn
, but with four arguments.
Examples
RESCRIPTConsole.warn4("Hello", "World", "ReScript", "!!!")
Console.warn4(#first, #second, #third, ("fourth"))
warn5
let warn5: ('a, 'b, 'c, 'd, 'e) => unit
warn5(v1, v2, v3, v4, v5)
. Like warn
, but with five arguments.
Examples
RESCRIPTConsole.warn5("Hello", "World", "from", "JS", "!!!")
Console.warn5([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"})
warn6
let warn6: ('a, 'b, 'c, 'd, 'e, 'f) => unit
warn6(v1, v2, v3, v4, v5, v6)
. Like warn
, but with six arguments.
Examples
RESCRIPTConsole.warn6("Hello", "World", "from", "JS", "!!!", '!')
Console.warn6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42)
warnMany
let warnMany: array<'a> => unit