1
0
Fork 0

add printlog() function that works like SG_LOG(). It takes two arguments:

a --log-level and a scalar. Example: printlog("info", "I want more noise");
This commit is contained in:
mfranz 2006-02-17 21:24:08 +00:00
parent a1a5a7e618
commit 003ae0986f

View file

@ -90,3 +90,15 @@ defined = func(sym) {
}
return 0;
}
##
# Print log messages in appropriate --log-level.
# Usage: printlog("warn", "...");
# The underscore hash is used for private variables.
#
_ = {};
_.dbg_types = { none:0, bulk:1, debug:2, info:3, warn:4, alert:5 };
_.log_level = _.dbg_types[getprop("/sim/logging/priority")];
printlog = func(t, m) { if(_.dbg_types[t] >= _.log_level) { print(m) } }