Skip to main content

print

Output debug messages to application logs.

Signature

print(...args)

Description

The print function outputs messages from your workflow scripts to the RocketWave Pulse Consumer's application logs. This is essential for debugging workflows and monitoring execution flow.

All output is logged with the userScript: true flag, making it easy to filter and identify script-generated logs.

Parameters

ParameterTypeDescription
...argsanyOne or more values to output. Objects are automatically JSON-serialized.

Returns

void — This function does not return a value.

Examples

Basic Logging

print('Hello, world!');
// Logs: [User Script] Hello, world!

Multiple Arguments

print('Processing event:', message.type, 'at', new Date().toISOString());
// Logs: [User Script] Processing event: touchdown at 2024-01-15T12:30:00.000Z

Logging Objects

print('Event data:', message);
// Logs: [User Script] Event data: {"type":"touchdown","team":"KC","player":"Mahomes"}

Debugging Workflow Logic

print('=== Workflow Start ===');
print('Event type:', message.type);
print('Condition result:', shouldProcess);

if (shouldProcess) {
print('Executing action...');
// ... action code
print('Action completed');
} else {
print('Skipping - condition not met');
}

print('=== Workflow End ===');

Log Format

Messages appear in the Consumer logs with the following format:

{
"level": "info",
"time": 1705322400000,
"userScript": true,
"args": 2,
"msg": "[User Script] Processing event: touchdown"
}

The userScript: true field allows you to filter for workflow-generated logs specifically.

Best Practices

Use Meaningful Prefixes

print('[VALIDATE]', 'Checking event structure');
print('[AI]', 'Calling OpenAI API');
print('[SOCIAL]', 'Posting to Mastodon');
print('[ERROR]', 'Failed to process:', error.message);

Log Input and Output

print('Input message:', JSON.stringify(message, null, 2));
// ... process message
print('Generated output:', result);

Avoid Sensitive Data

// ❌ Bad - logs API key
print('Using token:', OPENAI_API_KEY);

// ✅ Good - logs that key exists
print('API key configured:', !!OPENAI_API_KEY);

Notes

  • The print function is synchronous and does not return a promise
  • Objects and arrays are automatically serialized using JSON.stringify()
  • Circular references in objects will be converted to [Circular]
  • Very large objects may be truncated in logs