Logs an exception to a span and sets exception-related attributes.
The error object to be logged.
The span to log the exception to. If not provided, the active span is used. If no active span is available, the error is logged to the console.
Logs an exception to a span and sets exception-related attributes.