title: “EXCEPTION::LOGERR” author: “laplante@plcb.ca” date: “2025-09-11” version: “1.0.1”
exception::logerr — print a formatted message to stderr (CLI) or error logfile (Web)
This function is the equivalent of Golang printf
.
The format
string supports the following verbs:
%!v(MISSING)
: default format. For structs, %!v(MISSING)
adds field names.%!v(MISSING)
: Go-syntax representation of the value.%!T(MISSING)
: type of the value.%
: literal percent sign.%!t(MISSING)
: prints true
or false
.%!b(MISSING)
: base 2.%!c(MISSING)
: character represented by Unicode code point.%!d(MISSING)
: base 10.%!o(MISSING)
: base 8.%!O(MISSING)
: base 8 with 0o
prefix.%!q(MISSING)
: single-quoted character literal, safely escaped with Go syntax.%!x(MISSING)
: base 16, lower-case.%!X(MISSING)
: base 16, upper-case.%!U(MISSING)
: Unicode format, e.g. U+1234
.%!b(MISSING)
: decimalless scientific notation, exponent a power of two.%!e(MISSING)
/ %!E(MISSING)
: scientific notation.%!f(MISSING)
/ %!F(MISSING)
: decimal point, no exponent.%!g(MISSING)
/ %!G(MISSING)
: compact format depending on exponent size.%!x(MISSING)
/ %!X(MISSING)
: hexadecimal floating-point.%!s(MISSING)
: uninterpreted bytes of string.%!q(MISSING)
: double-quoted, safely escaped.%!x(MISSING)
: base 16, two characters per byte, lowercase.%!X(MISSING)
: base 16, two characters per byte, uppercase.%!p(MISSING)
: base 16 notation with 0x
prefix.%!b(MISSING)
, %!d(MISSING)
, %!o(MISSING)
, %!x(MISSING)
, %!X(MISSING)
also work with pointers.bool
→ %!t(MISSING)
int
, int8
… → %!d(MISSING)
uint
, uint8
… → %!d(MISSING)
, %!x(MISSING)
if %!v(MISSING)
usedfloat32
… → %!g(MISSING)
string
→ %!s(MISSING)
%!f(MISSING)
→ default width, precision.%!f(MISSING)
→ width 9, default precision.%!f(MISSING)
→ precision 2.%!f(MISSING)
→ width 9, precision 2.%!f(MISSING)
→ width 9, precision 0.+
: always print sign.-
: left-justify.#
: alternate format (e.g. 0b
, 0o
, 0x
).0
: pad with zeros.res={{
a := [1, 2.2, "3"];
logerr("%!T(MISSING) %!T(MISSING) %!T(MISSING)\n", a);
}}.
Return:
res=int64 float64 string
res={{
a := [1, 2.2, "3", [1,2,3]];
logerr("%!T(MISSING) %!T(MISSING) %!T(MISSING) %!T(MISSING)\n", a);
}}.
Return:
res=int64 float64 string int64
%!!(MISSING)(EXTRA int64=2, int64=3).