Structured JSON logging with correlation IDs for multi-service systems. Use when implementing logging, debugging failures, or tracing errors across services. Triggers on: add logging, error handling, debug failures, trace errors.
Structured JSON logging with correlation IDs for multi-service systems.
Start operation with appropriate prefix (liq_, arb_, quo_, op_).
Include correlation ID in all related log entries.
Pass via X-Correlation-ID header across services.
{
"timestamp": "2024-01-15T14:32:01.847Z",
"level": "ERROR",
"correlation_id": "liq_18d4f2a1_x7k9",
"service": "rust-hotpath",
"event_type": "TX_REVERT",
"message": "Liquidation reverted",
"context": {}
}
Format: {prefix}_{timestamp_hex}_{random}
Prefixes: liq_, arb_, quo_, op_
const ctx = log.startOperation('liq');
log.error(ctx, 'TX_REVERT', 'Failed', { tx_hash, gas_used });
// Propagate via HTTP