Back to EIP
Wire Tap
⋯
service /warehouse on new http:Listener(8080) {
resource function get stock(string parentId, string productId) returns StockResponse|error {
StockResponse result = check sapClient->/WarehousePhysicalStockProducts/[parentId]/[productId];
worker w returns error? {
check wiretap("stock", "INFO", result.toString());
}
return result;
}
}
function wiretap(string tableName, LogLevel severity, string message) returns error? {
SnowflakeRequest snowflakeRequest = {statement: string `insert into ${tableName} values (${message}, ${severity}))`};
json _ = check db->/statements.post(snowflakeRequest);
}