29 lines
491 B
Python
Executable File
29 lines
491 B
Python
Executable File
"""
|
|
Captura de stack traces
|
|
"""
|
|
|
|
import logging
|
|
|
|
print('Captura de error:\n')
|
|
try:
|
|
a = [1,2,3]
|
|
val = a[4]
|
|
except IndexError as e:
|
|
logging.error(e)
|
|
|
|
print('\n\nCaptura de error mas seguimiento:\n')
|
|
try:
|
|
a = [1,2,3]
|
|
val = a[4]
|
|
except IndexError as e:
|
|
logging.error(e, exc_info=True)
|
|
|
|
|
|
print('\n\nCaptura de error desconocido y seguimiento:\n')
|
|
import traceback
|
|
try:
|
|
a = [1,2,3]
|
|
val = a[4]
|
|
except:
|
|
logging.error('El error es %s', traceback.format_exc())
|