One of the most helpful parts of Iguana is the logging system. It’s super easy to build intuitive logging for your own components using it. Here are a few pointers:
Expand |
---|
title | iguana.log* give gives us calls to the logging system |
---|
|
So this is an example of a log message: Code Block |
---|
iguana.logInfo("#custom #me This is a custom log") |
|
Expand |
---|
title | You can use #hashtags in your log messages |
---|
|
This makes it a little easier to view the logs and filter on the tags by clicking on them: See the #custom. If you were to click on it, this is what you would see: Cool eh? Very nice way of filtering your log data. Switching on Matches only: |
Expand |
---|
title | I guess we probably over designed it have logInfo and logWarning etc. in the system |
---|
| That’s a bit of hang over from Iguana 6 days.
🙄
We may simplify things in the future and make all these log commands like logInfo etc. just be aliases for log.
#hashtags are a simpler more flexible way of doing thingsYou can trigger custom Iguana X notifications |
|
In the Translator, you can use iguana.log to provide a hook for implementing custom notification logic. For example, if you write this helper function: Code Block |
---|
| function Alert(Message)
iguana.log("ALERT: "..Message)
end |
Then create a Log Contains Notifications rule using the key word “ALERT:“ to trigger a notification anytime there is a match in the component’s logs. |
Expand |
---|
title | You can relate messages together using message id that is returned from queue.push{data=Message} |
---|
|
This is how you do it: Code Block |
---|
local MessageId = queue.push{data="A message"}
iguana.logInfo("This is associated with tahtthat message.", MessageId) |
Now this custom informational log you just created, will be related in the logs to the message queued. |
That’s it! Simple and powerful.