Logging
Rhai
Rhai has two built in functions for logging, print and debug.
print(string)
Prints a string to the console.
print("Hello World!");
INFO [post_release/test.rhai] Hello World!
debug(any)
Prints a representation of the value to the console if the --debug flag is passed to HEMTT.
debug(HEMTT.version().to_string());
debug(HEMTT.project().version.major());
DEBUG [post_release/test.rhai] "1.23.1"
DEBUG [post_release/test.rhai] 1
HEMTT
HEMTT provides additional logging functions.
info(string)
Prints a string to the console. Same functionality as print.
info("Hello World!");
INFO [post_release/test.rhai] Hello World!
warn(string)
Prints a string to the console with a warning prefix.
warn("Hello World!");
WARN [post_release/test.rhai] Hello World!
error(string)
Prints a string to the console with an error prefix.
error("Hello World!");
ERROR [post_release/test.rhai] Hello World!
fail(string)
Prints a string to the console with an error prefix, HEMTT will mark the build as failed and exit immediately.
fail("Hello World!");
ERROR [post_release/test.rhai] Hello World!
fatal(string)
Similar to fail(string), but indicates a fatal error and HEMTT will print an error showing where the fatal was called.
fatal("Hello World!");
ERROR [post_release/test.rhai] Hello World!
error[BHE4]: Script /.hemtt/hooks/post_release/test.rhai failed at runtime
┌─ .hemtt/hooks/post_release/test.rhai:6:5
│
6 │ fatal("Hello World!");
│ ^ runtime error: Script called fatal (line 6, position 5)