There are several approaches to pass logging strings and variables into console.log/console.error
//All useful info will be printed and being consistent
console.log('name:', $username, 'details:', $detailJSON, 'exception stacks:', $ex);
//This will print all useful info but we are mixing different approaches: first 2 are using placeholders %s and %j, while the last one is not
console.log('name: %s, details: %j, exception stacks:', $username, $detailJSON, $ex);
//$detailJSON will be printed as [object Object]
console.log(`name: $username, details: {$detailJSON}, exception stacks: ${ex}`);
//$ex will be printed as {}
console.log('name: %s, details: %j, exception stacks: %j', $username, $detailJSON, $ex);