AIML Docs

Log Element

Element for outputting debug messages

Log Element

The <log> element outputs messages for debugging and tracing:

<log
label="Debug"
expr={({state}) => `Current count: ${state.count}`}
/>
PropTypeDefault
id?
string
-
label?
string
-
expr
Expression
-

Examples

Basic Logging

<log expr="Starting process..." />

State Debugging

<log 
label="State Debug"
expr={({state}) => JSON.stringify(state, null, 2)}
/>

Error Logging

<log
label="Error"
expr={({error}) => `Error occurred: ${error.message}`}
/>

Usage Notes

  • Use descriptive labels for better log organization
  • Include relevant context in log messages
  • Consider log levels for different types of information
  • Use structured logging for complex data

On this page