macro_rules! udf_log {
(Critical: $($msg:tt)*) => { ... };
(Error: $($msg:tt)*) => { ... };
(Warning: $($msg:tt)*) => { ... };
(Note: $($msg:tt)*) => { ... };
(Debug: $($msg:tt)*) => { ... };
($msg:tt) => { ... };
}Expand description
Print a formatted log message to stderr to display in server logs
Performs formatting to match other common SQL error logs, roughly:
2022-10-15 13:12:54+00:00 [Warning] Udf: this is the message
use udf::udf_log;
// Prints "2022-10-08 05:27:30+00:00 [Error] UDF: this is an error"
// This matches the default entrypoint log format
udf_log!(Error: "this is an error");
udf_log!(Warning: "this is a warning");
udf_log!(Note: "this is info: value {}", 10 + 10);
udf_log!(Debug: "this is a debug message");
udf_log!("i print without the '[Level] UDF:' formatting");