...
Code Block |
---|
-- Get all channel status and log stopped channels in Iguana Log function main() -- 1) Retrieve status local status = iguana.status() -- 2) Parsed status and count all channels local parsedStatus = xml.parse{data=status} local iguanaParsedStatus = parsedStatus.IguanaStatus local count = iguanaParsedStatus:childCount("Channel") -- 3) Find all the stopped channels local stopped = {} for i = 1, count do if iguanaParsedStatus:child("Channel", i).Status:nodeValue() == 'off' then table.insert(stopped, iguanaParsedStatus:child("Channel", i).Name:nodeValue()) end end -- 4) Create a stopped channel warningswarning in Iguana loglogs if (#stopped > 0) then local warningHeader = "The following channels are off:\n\n" local warningBody = table.concat(stopped, "\n") iguana.logWarning(warningHeader .. warningBody) end end |
...
This will generate logs that look like this:
...