Overview
Thelog syscall outputs data to the console for debugging and diagnostic purposes. It prints the specified data directly to stdout.
Syscall Code
Code:0x0C (TN_SYSCALL_CODE_LOG)
C SDK Function
Arguments
Pointer to the data to be logged.
Length of the data to log in bytes. Must not exceed the maximum log data size.
Return Value
Returns a syscall result code:TN_VM_SYSCALL_SUCCESS(0) - Data logged successfully
TN_VM_ERR_SYSCALL_LOG_DATA_TOO_LARGE(-29) - Data exceeds maximum log sizeTN_VM_ERR_SYSCALL_INVALID_ADDRESS(-21) - Invalid virtual address for data
Resource Consumption
Compute Units
- Base cost: None (log syscalls donβt charge compute units)
- Total cost: 0 units
- Rationale: Logging is considered a debugging aid and is not charged
Memory Pages
- Page usage: No page allocation
- I/O overhead: Minimal system overhead for stdout operations
- Buffer management: Uses system stdout buffer
Side Effects
- Console output: Writes data directly to stdout
- Buffer flushing: Flushes stdout buffer after writing
Size Limitations
- Maximum log data size:
TN_VM_LOG_DATA_MAX_SIZE(1024 bytes) - Attempts to log more data will result in an error
- No truncation is performed - the entire operation fails
Output Behavior
- Data is output byte-for-byte to stdout
- No formatting, newlines, or prefixes are added
- Output is immediately flushed to ensure visibility
- Binary data is output as-is (may include non-printable characters)
Usage Notes
- Intended for debugging and diagnostic purposes only
- Should not be used for production data exchange
- Performance impact is minimal but output is synchronous
- Consider the security implications of logging sensitive data
The log syscall outputs raw data to stdout. Be careful not to log sensitive information such as private keys, authentication tokens, or user data in production environments.