This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Logging, trend log, resident scripts... best practices
#5
Add this to common functions:
Code:
local current_log_level = 0 -- adjust as needed

function log_level(level, ...)
  if current_log_level >= level then
    log(...)
  end
end

Then specify log level as first argument to log_level() function and use it the same as standard log(). The only limitation is that this approach will not work for resident scripts as common functions library is loaded only once when script starts.
Reply


Messages In This Thread
RE: Logging, trend log, resident scripts... best practices - by admin - 07.02.2019, 08:02

Forum Jump: