1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
// SPDX-License-Identifier: MPL-2.0
// (c) Hare authors <https://harelang.org>
use fmt;
use os;
// Prints data to the log, with a newline.
export fn lprintln(log: *logger, fields: fmt::formattable...) void = {
log.println(log, fields...);
};
// Formats and prints data to the log, with a newline.
export fn lprintfln(log: *logger, fmt: str, fields: fmt::field...) void = {
log.printfln(log, fmt, fields...);
};
// Prints data to the global log, with a newline.
export fn println(fields: fmt::formattable...) void = {
lprintln(global, fields...);
};
// Formats and prints data to the global log, with a newline.
export fn printfln(fmt: str, fields: fmt::field...) void = {
lprintfln(global, fmt, fields...);
};
// Prints data to the log with a newline, then terminates the process.
export fn lfatal(log: *logger, fields: fmt::formattable...) never = {
lprintln(log, fields...);
os::exit(255);
};
// Formats and prints data to the log with new line, then terminates the
// process.
export fn lfatalf(
log: *logger,
fmt: str,
fields: fmt::field...
) never = {
lprintfln(log, fmt, fields...);
os::exit(255);
};
// Prints data to the global log with new line, then terminates the process.
export fn fatal(fields: fmt::formattable...) never = {
lprintln(global, fields...);
os::exit(255);
};
// Formats and prints data to the global log with new line, then terminates the
// process.
export fn fatalf(fmt: str, fields: fmt::field...) never = {
lprintfln(global, fmt, fields...);
os::exit(255);
};
|