With code actions, you can use console.log and console.error to log messages just like you would with node.js.

// User shares an image
console.log('View params', payload.params)
// Something bad
console.error('This is not good', err)

Any errors will show up in the notification bar as well as within the log view of the code editor.