Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleAdd some custom logging

Let’s add some Custom Logging

Just added lines 7 and 11 to the script:

Code Block
languagelua
function main(Data)
   local F = component.fields().InputFile
   trace(F)
   local Content = FILread(F)
   local List = Content:split("\n")
   trace(#List)  
   iguana.logInfo("#start About to queue "..#List.." messages");
   for i=1, #List do
      queue.push{data=List[i]}
   end
   iguana.logInfo("#end Finished queueing "..#List.." messages");
end

See Concatenating strings for more on the “..“ notation to bring join strings together.

Expand
titleAnd some custom status

See Custom Status

Code Block
languagelua
require "FIL.FILreadWrite"

function Status(N, Total)
   component.setStatus{data="Sending "..N.." of "..Total}  
end

function StatusDone(Total)
   component.setStatus{data="Completed sending "..Total.." messages."}
end

function main(Data)
   local F = component.fields().InputFile
   trace(F)
   local Content = FILread(F)
   local List = Content:split("\n")
   trace(#List)  
   iguana.logInfo("#start About to queue "..#List.." messages");
   for i=1, #List do
      Status(i, #List)
      queue.push{data=List[i]}
   end
   StatusDone(#List)
   iguana.logInfo("#end Finished queueing "..#List.." messages");
end

...