From: James Turner Date: Thu, 7 Feb 2013 16:44:24 +0000 (+0000) Subject: Support logging from Nasal at custom levels. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b52a61c2cb313b1818b77c255c6f411f3d8025ee;p=flightgear.git Support logging from Nasal at custom levels. For now, print() still logs at SG_ALERT level. --- diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index ef6440d3d..2c98f6369 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -314,6 +314,27 @@ static naRef f_print(naContext c, naRef me, int argc, naRef* args) return naNum(buf.length()); } +// logprint() extension function. Same as above, all arguments after the +// first argument are concatenated. Argument 0 is the log-level, matching +// sgDebugPriority. +static naRef f_logprint(naContext c, naRef me, int argc, naRef* args) +{ + if (argc < 1) + naRuntimeError(c, "no prioirty argument to logprint()"); + + naRef priority = args[0]; + string buf; + int n = argc; + for(int i=1; i