Logging
Các loại log
VD:
import logging
from pythonjsonlogger import jsonlogger
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
logHandler = logging.StreamHandler()
logHandler.setFormatter(jsonlogger.JsonFormatter())
logger.addHandler(logHandler)
logger.info('', extra={'info': 'debugThis message should go to the log file'})
logger.debug('', extra={'debug': 'debugThis message should go to the log file'})
logger.error('', extra={'error': 'debugThis message should go to the log file'})
logger.warning('', extra={'warning': 'debugThis message should go to the log file'})Custom logging
Last updated