Descripción
Catch an exception and log it using the logging module
File Template: ❌
Prefix
log:exception
Scopes
python
Snippet de código
import logging
logger = logging.getLogger(__name__)
try:
${1:# code that may raise an exception}
except ${2:Exception} as ${3:e}:
logger.error("${4:Error message}", exc_info=True)