<log>

Feature Request #2: Log Plugin

Core v2.2.0

Overview

Writes text to standard output (stdout) or standard error (stderr). Useful for debugging, progress monitoring, and integration with CI/CD pipelines.

Usage Examples

Example 1: Basic Progress Logging

example-1.xml
<config>
    <loop item="url" index="i">
        <list>
            <template>https://page1.com</template>
            <template>https://page2.com</template>
            <template>https://page3.com</template>
        </list>
        
        <log>Processing page ${i}: ${url}</log>
        
        <var-def name="response">
            <http url="${url}"/>
        </var-def>
    </loop>
</config>

Example 2: Error Logging

example-2.xml
<config>
    <try>
        <var-def name="data">
            <http url="https://api.example.com/data"/>
        </var-def>
    </try>
    <catch>
        <log dest="err">ERROR: Failed to fetch data - ${sys.exception}</log>
        <log dest="err">Timestamp: ${sys.currentTime()}</log>
    </catch>
</config>

Example 3: Debug Information

example-3.xml
<config>
    <log>Starting scraper...</log>
    
    <var-def name="page">
        <http url="https://example.com"/>
    </var-def>
    
    <log>Page fetched: ${sys.length(page)} bytes</log>
    
    <var-def name="title">
        <xpath type="css" expression="title">
            <html-to-xml>${page}</html-to-xml>
        </xpath>
    </var-def>
    
    <log>Title extracted: ${title}</log>
    <log>Scraper completed successfully!</log>
</config>

Example 4: Conditional Logging

example-4.xml
<config>
    <var-def name="count">
        <xpath expression="count(//item)">
            <html-to-xml>${response}</html-to-xml>
        </xpath>
    </var-def>
    
    <if condition="${count > 0}">
        <log>Found ${count} items to process</log>
    </if>
    <else>
        <log dest="err">WARNING: No items found!</log>
    </else>
</config>

Parameters