This topic contains 3 replies, has 2 voices, and was last updated by  Eliot Muir 9 years, 1 month ago.

More insight into iguana.logInfo

  • I’m working on a comprehensive error handling module, and I am building the kind of “errors list” that you see in My code looks like:

          local Errs = validate.CheckAdt(MsgIn)
          if Errs then
             for i = 1, #Errs do
             return true 

    I’m concerned, though, that if a message has multiple lines in Errs, then in the logs, I’ll see an entry for each one of those lines. Is there a way that I can aggregate the logInfo lines and put them into the logs as a block of text, rather than multiple entries of one line each?

    -Robert James,
    Interface Analyst,
    GetWellNetwork, Inc.

    Yes just loop through the lines and append them into one string. If performance is an issue you can use:

    This is a good article I often point out new devs to talking about the issues with concatenating many many many strings together:

    But in this case a simple loop like:

    local R = 'Errors!\n'
    for i=1, #Errs do
         R = R..Errs[i].."\n"

    Should perform fine unless you have 1000+ errors…

    Should do the trick.

    Ah, I was so close! I was using \r instead of \n.

    That said, I’m still having a problem. The list (the one you called R) is building correctly, but it won’t write into the log. The only thing I see there is the ‘Errors!” from the initial assignment.

    You must be logged in to view attached files.

    -Robert James,
    Interface Analyst,
    GetWellNetwork, Inc.

    Try \r\n or \n …?

    I haven’t actually tried it 🙂 One of those combinations should do the trick.

You must be logged in to reply to this topic.